Solved Xcopy strange behaviour? ** Solved **

Arnak

New Member
Messages
3
I found the culprit, it was the /e copying all the subdirectories for some reason?

Hi,

I have a batch file to copy over some data for backup.

The following command is used xcopy "C:\program files (x86)\*.s3db" /e /v /I /y /h M:\Pams Backups\Money

The batch file creates the directory and copies over the 2 .s3db backup files as it should but then starts to copy over the rest of the program files directory, starting with Adobe!!!

Can you please explain why it is doing that and not stopping after the .s3db files?

Thanks,

Martin
 
Last edited:
If need be, run this batchfile over to sevenforums, there are some very good batchile kings in there.
"...starts to copy over the rest of the program files directory, starting with Adobe..."
I think you're saying that other stuff is being copied into the created directory, correct?
"...explain why it is doing that and not stopping after the .s3db files?"
I am not savvy about xcopy, however, the batchfile kings in sevenforums probably are very savvy about xcopy.
 
...The batch file creates the directory and copies over the 2 .s3db backup files as it should but then starts to copy over the rest of the program files directory, starting with Adobe!!!

Can you please explain why it is doing that and not stopping after the .s3db files?

It's the /E option. This specifically tells XCopy to copy over all empty directories too. Your Adobe (et. al.) directory matches as a directory that is 'empty' because it contains no .s3db files, therefore an empty Adobe directory will be copied over.

/e
Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options.
Microsoft Docs | xcopy
 
Unless one is a real Batchfile Guru, it's helpful to have a printed listing of all the XCOPY switches available while composing the batch file.
I also use batch files to back up all my data files (My Documents) to multiple external drives. My command line contains at least six switches, to make sure I get everything I want.
I use the " /s " switch a lot, but I can't remember ever using the " /e " switch. I don't know why I would.

Y'all have a great 2020 now, Y'hear?
:cool:
 
Back
Top