|
-
February 9th, 2006, 06:38 AM
#1
xcopy selected folders
Hi there.
I'd like to make a batch file that will copy selected folders and sub folders within those from a network location to en external drive.
The network drive is mapped to F: on the pc I'm using.
And the external drive is P:
Let's say the folders on F that I wish to xcopy are called Alpha, Beta and Gamma.
What would be the command that would copy these 2 folders and all their sub folders to P:\backup
I know all about switches and presume they would go at the end of the command as usual.
I have posted here as I thought it was the best place but if anybody feels this is not the correct forum area please move my post to one that is.
Thanks in advance
SS UK
-
February 9th, 2006, 06:55 AM
#2
As a single command:
Code:
for %x in (alpha beta gamma) do xcopy f:\%x\*.* p:\backup\%x /e /i
Which produces the same results as these three separate commands:
Code:
xcopy f:\alpha\*.* p:\backup\alpha /e /i
xcopy f:\beta\*.* p:\backup\beta /e /i
xcopy f:\gamma\*.* p:\backup\gamma /e /i
-
February 9th, 2006, 08:28 AM
#3
Great
Thanks
Sorry for double posting.
Don't suppose there is a similar command for xcopying all the folders in APART from those specified is there?
Only because the number of folders that I DO wish to xcopy is by far geater then the number of those that I DONT.
Cheers
-
February 9th, 2006, 08:50 AM
#4
If you're using XP, do a:xcopy /? at a CMD prompt and note the/exclude:... option.
-
February 9th, 2006, 09:56 AM
#5
xcopy f:\*.* p:\gav\backups\fdrive /e/h/k/y/c/r/o/i/EXCLUDE:\rack\+\archive\
Could you tell me what's wrong with this please?
It's not working for me.
I'm trying to copy all files under f:\ apart from the rack and archive folders and all files within.
I don't have a gap between the * and the p on the command line, it's just the way it's posted here.
Thanks
-
February 9th, 2006, 10:03 AM
#6
SS UK: If I may, I'd like to suggest something much much easier than xcopy. If you are running in Windows, try free SyncBack. You can do straight backups or synchronizations. Short learning curve and reliable. I couldn't function without it.
http://www.snapfiles.com/get/SyncBack.html
-
February 9th, 2006, 12:23 PM
#7
 Originally Posted by SS UK
xcopy f:\*.* p:\gav\backups\fdrive /e/h/k/y/c/r/o/i/EXCLUDE:\rack\+\archive\
Could you tell me what's wrong with this please?
It's not working for me.
I'm trying to copy all files under f:\ apart from the rack and archive folders and all files within.
I don't have a gap between the * and the p on the command line, it's just the way it's posted here.
Thanks
You need to list each string that you want to exclude on separate lines in a text file, (and then specify the name of this file in your XCOPY command).
If any of your listed strings match any part of the absolute path of any file to be copied, that file will then be excluded from the copying process.
For example, if you specify the string "\Obj\", you exclude all files underneath the Obj directory. If you specify the string ".obj", you exclude all files with the .obj extension. If you specify the string "obj", you exclude everything with the string "obj" anywhere in the absolute path.
-
February 9th, 2006, 02:32 PM
#8
Thanks for all help
On this occasion I've deployed the software suggested by HAN
I've done some dummy runs and verified the data and it looks to work fine for me.
There's a setting in there that lets you not use windows shell for copying.
When I use ntbackup to back up Novell files it does not do it properly. All the file sizes are wrong.
I have posted about this on here but I think it's foxing people as to why.
This Syncback seems to cope ok with it. The check box to not use the Winows Shell even mentions that it may solve some Novell Server problems.
Thanks
-
February 9th, 2006, 03:16 PM
#9
You're welcome. Good to hear you found a workable solution.
-
February 9th, 2006, 04:45 PM
#10
Glad to hear it works for you too! Great little app...
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|