Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Windows XP Windows XP
Search Search
Search for:
Tech Support Guy > > >

Batch file to copy subfolders?


(!)

halcour's Avatar
halcour halcour is offline
Member with 486 posts.
THREAD STARTER
 
Join Date: Mar 2005
Experience: Intermediate
07-Jul-2005, 07:30 AM #1
Batch file to copy subfolders?
Is there a simple way to copy an entire folder and its subfolders to another location using a batch file?

Thanks,
Harold
DoubleHelix's Avatar
Account Disabled with 24,388 posts.
 
Join Date: Dec 2004
07-Jul-2005, 07:38 AM #2
Use XCOPY. At a command prompt, type: xcopy /? to see how to use it.
halcour's Avatar
halcour halcour is offline
Member with 486 posts.
THREAD STARTER
 
Join Date: Mar 2005
Experience: Intermediate
07-Jul-2005, 07:41 AM #3
Boy that was fast! Thanks DH!

Harold
DaveBurnett's Avatar
DaveBurnett   (Dave) DaveBurnett is online now DaveBurnett is a Trusted Advisor with special permissions. DaveBurnett has a Profile Picture
Computer Specs
Trusted Advisor with 8,906 posts.
 
Join Date: Nov 2002
Location: Polesworth, UK
Experience: Advanced
07-Jul-2005, 07:48 AM #4
Yes, the command you want is XCOPY
Open a Command prompt and type XCOPY /? to see the format of the command.
You can then create a text file with a .BAT extension containing the command and run it whenever you like.
Bob Cerelli's Avatar
Member with 22,468 posts.
 
Join Date: Nov 2002
07-Jul-2005, 09:28 AM #5
To answer the question, with XCOPY use the /S switch to copy subdirectories.

For example:

XCOPY C:\DATA G:\DATA /S

Would copy all the files in C:\DATA and the subdirectories to G:\DATA
JohnWill's Avatar
Computer Specs
Retired Moderator with 106,412 posts.
 
Join Date: Oct 2002
Location: South Eastern PA, USA
07-Jul-2005, 01:17 PM #6
Gee Bob, I think he figured it out with the Help already.

Give a man a fish and you'll feed him for a day. Teach a man to fish and you'll feed him for a lifetime.
Bob Cerelli's Avatar
Member with 22,468 posts.
 
Join Date: Nov 2002
07-Jul-2005, 01:21 PM #7
Didn't want to make any assumptions so decided just to give the specifics as well as an example. Hope that was ok.

Another switch I like to use is /D

This is handy when doing things like backing up just data files to another hard drive. This switch will only backup new or changed files. So after the first time a backup is made, it generally goes a lot faster than copying everything all over again.
__________________
Bob Cerelli
http://www.onecomputerguy.com
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑