I need to copy a set of files from source to destination on daily basis. So i need to skip the files already available on the destination directory.
If i use -y command while copying, it will ask confirmation to skip. But, i don't want to ask confirmation, it should skip always.
skip already available files destination
Moderator: DosItHelp
Re: skip already available files destination
robocopy with the /mir switch will mirror the folders, only copying new files and removing old ones. Is that what you want to do?
Test it on some dummy folders first.
Test it on some dummy folders first.
Re: skip already available files destination
I don't want to remove the old files which is already available in the destination folder. I just want to skip the files which is already available in the destination folder.
Suppose i have files name one.txt, two.txt, three.txt, four.txt,. etc in folder1... i want to copy all these files to folder2, which already contains one.txt and two.txt, So in this case these two files should skip from copying and i need the rest files in folder2.
Suppose i have files name one.txt, two.txt, three.txt, four.txt,. etc in folder1... i want to copy all these files to folder2, which already contains one.txt and two.txt, So in this case these two files should skip from copying and i need the rest files in folder2.
-
- Posts: 26
- Joined: 23 Dec 2013 07:07
Re: skip already available files destination
Can you not simply make a if statement?
if not exist "one.txt" copy "one.txt" "Destination" etc...
or even:
:copy_one
if exist "one.txt" goto copy_two
etc...
Not sure if this is what you want but hope it helps.
Matt
if not exist "one.txt" copy "one.txt" "Destination" etc...
or even:
:copy_one
if exist "one.txt" goto copy_two
etc...
Not sure if this is what you want but hope it helps.
Matt
Re: skip already available files destination
Robocopy by default does not copy same files, it copies only those which are different. That means it will only copy a file with the same name if its file size or time stamp differs from that which already exists in the destination.
Re: skip already available files destination
vishnuj wrote:I don't want to remove the old files which is already available in the destination folder. I just want to skip the files which is already available in the destination folder.
Compo is right, so use robocopy with the /e switch.
Code: Select all
Robocopy "c:\folder1" "d:\folder2" /e
Re: skip already available files destination
RightBehindu wrote:Can you not simply make a if statement?
if not exist "one.txt" copy "one.txt" "Destination" etc...
or even:
:copy_one
if exist "one.txt" goto copy_two
etc...
Not sure if this is what you want but hope it helps.
Matt
You could but that would be more code and run slower than Robocopy.