Solved

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

Posted on 2008-06-09
9
1,678 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
Industry Leaders: 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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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