Solved

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

Posted on 2008-06-09
9
1,673 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 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