?
Solved

File system task to move and rename the file

Posted on 2011-04-20
4
Medium Priority
?
230 Views
Last Modified: 2012-05-11
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!
0
Comment
Question by:sqlcurious
4 Comments
 
LVL 7

Accepted Solution

by:
Cboudroz earned 2000 total points
ID: 35437394
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
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35438483
Yes you can.
0
 

Expert Comment

by:ANDREBERNARDE
ID: 35438708
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
 

Author Closing Comment

by:sqlcurious
ID: 35749706
thnks
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question