Batch file query

B

Bill Ridgeway

I have a batch file which copies important files from the C: hard disk to
the D: hard disk. I recently found a few files in C:\Documents and settings
of which I would like to keep a copy. Not wanting to bother to copy some /
leave some I used XCOPY with flags /S /Y to copy the whole of the folder and
sub folders. (This worked OK on the original batch file). However, I have
found that not all the folders with files are being copied.

Any ideas why please?

Regards.

Bill Ridgeway
 
S

Shenan Stanley

Bill said:
I have a batch file which copies important files from the C: hard
disk to the D: hard disk. I recently found a few files in
C:\Documents and settings of which I would like to keep a copy. Not
wanting to bother to copy some / leave some I used XCOPY with
flags /S /Y to copy the whole of the folder and sub folders. (This
worked OK on the original batch file). However, I have found that
not all the folders with files are being copied.
Any ideas why please?

Regards.

Bill Ridgeway
 
S

Shenan Stanley

Bill said:
I have a batch file which copies important files from the C: hard
disk to the D: hard disk. I recently found a few files in
C:\Documents and settings of which I would like to keep a copy. Not
wanting to bother to copy some / leave some I used XCOPY with
flags /S /Y to copy the whole of the folder and sub folders. (This
worked OK on the original batch file). However, I have found that
not all the folders with files are being copied.
Any ideas why please?

Personally - I have started using the Microsoft SyncToy for such things.
That and Scheduled Tasks makes it much easier to do such backup procedures.

First - make sure you have permission to said directories - all of them.

Second - if the files/folders are in use - you may not be able to copy them
at that time.

Just use "/E" instead of "/S". It does the same thing - including copying
empty directories/sub-directories.

I have had batch scripts do this for me in the past.. I had them only
copying things that had changed since the last time it was ran. the line -
if I recall correctly - was:

xcopy c:\sourcedr\*.* z:\destinationdir\ /D /E /V /C /Q /G /H /R /K /X /Y

You can look at the xcopy help (or command line list) to see what each of
those switches do.

You may want to run the copy verbose - without actually copying and using
the /F and /L switches to see what *would* actually be copied - perhaps pipe
(>) the results to a test file for easy perusal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top