|
-
Apr 11th, 2008, 04:24 PM
#1
Thread Starter
Lively Member
HELP: Dos Programming to Copy file
Hi all
I am not sure where to post this question so I thought I just put it in general discussion, I hope someone can help me out
I need to create a batch file where it will copy a folder from C: drive to D: Drive
Now I read a couple copy command article and could not find one to set the parameter to skip all .. like - if the files already exist skip it
so the goal here I want to copy all files in C drive to D drive, and if the file already exist, don't overwrite it and instead skip to the next file.
Here is what I have
Code:
copy c:\test1\*.* d:\test1\*.* /y
/y = do not prompt for overwrite
ideally I want to say no to all / skip all , but only cope files that does not exist yet
is there a parameter for that?
Thank you
-
Apr 11th, 2008, 04:32 PM
#2
Re: HELP: Dos Programming to Copy file
General PC is a good place for this (moved).
-
Apr 11th, 2008, 04:32 PM
#3
Re: HELP: Dos Programming to Copy file
What you can try (try... try! Experiment first) is to use the DOS 'attrib' command to set the existing files to be read-only. Then copy the files over with the /y switch - it shouldn't overwrite the existing read-only files.
-
Apr 11th, 2008, 04:38 PM
#4
Thread Starter
Lively Member
Re: HELP: Dos Programming to Copy file
Hi all
I update it to use xcopy now. now it has param /y and /e to copy all the directory and subdirectory
Code:
xcopy C:\test1\*.* D:\test2\*.* /y /e
I plan to put this batch file into task scheduler, so I will have a daily copy of my files..
thanks in advance
Last edited by ndondo; Apr 11th, 2008 at 04:41 PM.
-
Apr 11th, 2008, 04:40 PM
#5
Thread Starter
Lively Member
Re: HELP: Dos Programming to Copy file
Or maybe another idea, I can just delete the file that has already been copied. so then I will only copy the latest file ..
the file name is incremental by today's date
eg:
test 04-11-2008.zip
test 04-12-2008.zip
test 04-13-2008.zip
so if I delete the file after copying I will not overwrite anything right?
thank for moving the post .
-
Apr 11th, 2008, 09:43 PM
#6
Re: HELP: Dos Programming to Copy file
there is an xcopy parameter for this. for a list of xcopy commands, type this at the command prompt:
The correct methods are one of two ways: either copy only files with the archive bit set, or copy files newer than a certain date. xcopy can do either.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|