Solved

MS DOS/Windows Batch - Copy all directories bu exclude files that end with .pag or .ind

Posted on 2008-06-09
9
1,667 Views
Last Modified: 2008-07-15
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....

0
Comment
Question by:elwayisgod
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 21744531
use the
/EXCLUDE *.pag +*.ind
parameter...
0
 
LVL 7

Expert Comment

by:CorruptedLogic
ID: 21744549
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.
0
 

Expert Comment

by:mikewurtz
ID: 21744553
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.
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 69

Expert Comment

by:Qlemo
ID: 21744561
If you create a file with contents:

.pag
.ind

and feed this file into /exclude argument of xcopy, it should work!
0
 

Author Comment

by:elwayisgod
ID: 21744650
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\Mon\" "I:\Newmont\Mon\" /Y /S /E /i /EXCLUDE:xcopy_exclude.txt
0
 

Author Comment

by:elwayisgod
ID: 21744679
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?
0
 

Author Comment

by:elwayisgod
ID: 21744869
Does Xcopy even work on XP?
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 125 total points
ID: 21744920
Sure it does.
Why not try pointing to your file?

xcopy "X:\EssbaseBackup\Weekly\Mon\" "I:\Newmont\Mon\" /Y /S /E /i /EXCLUDE:c:\pathtofile\xcopy_exclude.txt
0
 
LVL 7

Expert Comment

by:CorruptedLogic
ID: 21745388
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) )
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question