Solved

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

Posted on 2008-06-09
9
1,651 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
 
LVL 68

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now