Hello, I am using robocopy to copy files from source to destination folder but there are some problems.<\/p>\n
In the source folder .csv files are created by various users every 15-20 mins for example User1.csv, User2.csv, User3.csv. There is an archive folder on the source folder.<\/p>\n
These files have to be moved to a destination folder. The files on the destination folder are uploaded to a different application every 30 mins.<\/p>\n
Problem: When user1 creates a file user1.csv, it has to be moved to the destination folder. If a file already exists on the destination folder then it should not be moved. But if no file exists on the destination folder then the file needs to be moved and a copy of the file has to be saved on archive folder.<\/p>\n
@echo<\/span> off<\/p>\n SET SORC= “C:\\Test\\Source” ROBOCOPY %SORC% %DEST% *.csv /R:1 /W:1 /MOV /XN /XO /LOG:%LOG%<\/p>\n :END<\/p>\n I am using the above code to move the files.<\/p>\n How can i save the files on the archive folder with the same name every time a new file is created?<\/p>","upvoteCount":4,"answerCount":3,"datePublished":"2018-08-13T15:30:48.000Z","author":{"@type":"Person","name":"spiceuser-togtk","url":"https://community.spiceworks.com/u/spiceuser-togtk"},"suggestedAnswer":[{"@type":"Answer","text":" Hello, I am using robocopy to copy files from source to destination folder but there are some problems.<\/p>\n In the source folder .csv files are created by various users every 15-20 mins for example User1.csv, User2.csv, User3.csv. There is an archive folder on the source folder.<\/p>\n These files have to be moved to a destination folder. The files on the destination folder are uploaded to a different application every 30 mins.<\/p>\n Problem: When user1 creates a file user1.csv, it has to be moved to the destination folder. If a file already exists on the destination folder then it should not be moved. But if no file exists on the destination folder then the file needs to be moved and a copy of the file has to be saved on archive folder.<\/p>\n @echo<\/span> off<\/p>\n SET SORC= “C:\\Test\\Source” ROBOCOPY %SORC% %DEST% *.csv /R:1 /W:1 /MOV /XN /XO /LOG:%LOG%<\/p>\n :END<\/p>\n I am using the above code to move the files.<\/p>\n How can i save the files on the archive folder with the same name every time a new file is created?<\/p>","upvoteCount":4,"datePublished":"2018-08-13T15:30:48.000Z","url":"https://community.spiceworks.com/t/copy-files-from-one-server-to-another/667430/1","author":{"@type":"Person","name":"spiceuser-togtk","url":"https://community.spiceworks.com/u/spiceuser-togtk"}},{"@type":"Answer","text":" Use ROBOCOPY /? to get the parameters to do what you’re after.<\/p>","upvoteCount":0,"datePublished":"2018-08-13T16:02:46.000Z","url":"https://community.spiceworks.com/t/copy-files-from-one-server-to-another/667430/2","author":{"@type":"Person","name":"seanwolsey","url":"https://community.spiceworks.com/u/seanwolsey"}},{"@type":"Answer","text":"
\nSET DEST=“C:\\Test\\Destination”
\nSET LOG=“C:\\Test\\THE LOG FILE.log”<\/p>\n
\nSET DEST=“C:\\Test\\Destination”
\nSET LOG=“C:\\Test\\THE LOG FILE.log”<\/p>\n