Quantcast
Viewing all articles
Browse latest Browse all 12963

copy all files and renaming them

Hi

My SQL script needs to copy all backup files in a folder to another one while renaming them at the same time by adding the time stamp like this: Originalfilename[Timestamp].bak

Basically the script looks like this:

declare@cmdstringvarchar(1000)

declare@filenamestrvarchar(100)

set@filenamestr= CURRENT_TIMESTAMP

set@cmdstring= 'copy \\Webserver\BackupStorage\SQLbackup\*.* \\Webserver\BackupStorage\SQLbackupArchive\'

execmaster..xp_cmdshell@cmdstring – this part is not complete

What code needs to be added to rename each file during the copy process?

Patrick


Viewing all articles
Browse latest Browse all 12963

Trending Articles