File system task to move and rename the file

Hi experts, I need to move a file as well as rename it with a datestamp.
For example the source location is X:\BP.txt
I need to move it to X:\Archive_files\
and rename it to X:\Archive_files\BP_04202011.txt
So do I use two file system tasks, please help me through?
Thanks!
sqlcuriousAsked:
Who is Participating?
 
CboudrozConnect With a Mentor Commented:
each step are clearly explain here:
http://www.rafael-salas.com/2007/03/ssis-file-system-task-move-and-rename.html

In the example he had to move many files at once.  He used the Loop for each file in folder, but you don't need this if you only have one file to move.

0
 
Alpesh PatelAssistant ConsultantCommented:
Yes you can.
0
 
ANDREBERNARDECommented:
Stored Procedure:

DECLARE
      @TodayDate as varchar(40),
      @cmdstr as varchar(250),
SET @TodayDate = CONVERT(varchar(10), GETDATE(), 112)
SET @cmdstr = 'MOVE /Y "X:BP.txt" "X:\Archive_Files\BP_'+@TodayDate+'.ERR"'
EXEC master..xp_cmdShell @cmdstr ,no_outpu
0
 
sqlcuriousAuthor Commented:
thnks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.