elwayisgod
asked on
MS DOS/Windows Batch - Copy all directories bu exclude files that end with .pag or .ind
Hi,
I need to copy a directory and all its subfolders and files. However I need it to NOT copy any file ending in .pag or .ind. I usually use xcopy but can't figure out how to skip certain files....
I need to copy a directory and all its subfolders and files. However I need it to NOT copy any file ending in .pag or .ind. I usually use xcopy but can't figure out how to skip certain files....
You need to create a text file with the file extensions you wish to exclude. The file is very simple and yours should include the following:
.pag
.ind
Thats it. Save as exclusions.txt, then run xcopy with the /EXCLUDE:exclusions.txt argument at the end of the command, that should do it.
.pag
.ind
Thats it. Save as exclusions.txt, then run xcopy with the /EXCLUDE:exclusions.txt argument at the end of the command, that should do it.
Use robocopy.exe. It's included with Vista and Server 2003 or you can download it from Microsoft for XP computers.
Use /E to copy all subdirectories and files.
Use the "/XF *.pag *.ind" option to exlude files with those extensions.
Use /E to copy all subdirectories and files.
Use the "/XF *.pag *.ind" option to exlude files with those extensions.
If you create a file with contents:
.pag
.ind
and feed this file into /exclude argument of xcopy, it should work!
.pag
.ind
and feed this file into /exclude argument of xcopy, it should work!
ASKER
CorruptedLogic:
I'm trying your solution with a file named 'xcopy_exclude.txt'. That file is:
*.ind
*.pag
Then I run the below and nothing is copied it just scrolls really fast.....
xcopy "X:\EssbaseBackup\Weekly\M on\" "I:\Newmont\Mon\" /Y /S /E /i /EXCLUDE:xcopy_exclude.txt
I'm trying your solution with a file named 'xcopy_exclude.txt'. That file is:
*.ind
*.pag
Then I run the below and nothing is copied it just scrolls really fast.....
xcopy "X:\EssbaseBackup\Weekly\M
ASKER
X:\ is a mapped drive on my laptop to our server. I:\ is a usb drive plugged into my laptop. Does that make a difference?
ASKER
Does Xcopy even work on XP?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Ditto to what sirbounty suggests. Unless the xcopy_exclude.txt file is in the same folder you run the command from, it will not be found (unless you add that folder to your path statement, but that's another story :o) )
/EXCLUDE *.pag +*.ind
parameter...