Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Directory 1

Status
Not open for further replies.

itorient

Technical User
Joined
Feb 20, 2004
Messages
29
Location
US
I just want to copy the entire directory from one server location to another server location but exlude some file that are not needed, e.g. .txt file. I am not sure about the command afere copy. Thanks in advance.
 
Hello

The easiest way I know is to use the command line. Firstly, use the ATTRIB command to add the hidden attribute to all .txt files:

ATTRIB +H *.txt /s

then use XCOPY to copy the source tree to the destination:

XCOPY I:\Sourcedir\*.* /s /e J:\Destination

Then CD back to the source and use Attrib to remove the hidden attribute:

ATTRIB -H *.txt /s

John
 
Thanks, John. It works! Here is something more. How about those subdirectory within subdirectory. It seems that it does not copy subdirectory. Thanks again.
 
Using the "/s" option should let it copy the subdirectories (folders) with files in it, and the /e option should let it copy empty subfolders as well.
If you did use this, can you post the exact command line that you used here.

John
 
You are right, John, I missed the /s in the command line. Thanks so much for your help on this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top