|
Answer» I have a folder with thousands of subdirectories where I need to copy just certain ones to another drive. I have a list of all the directories I need but can't figure out how to script it.
Thanks for any help.If you already have the list, yum have half of the problem. Haves fast can you TYPE? EXAMPLE: A list file like this: Code: [Select]/new/pix/dumdum/jpg /new/pix/stupid.gif /old/art/dumdum2.jpg /old/art/stupid2.gif ... Then what you do is add a unique tag chars the start and end of each line Notepad will work. Like this: Code: [Select]# /new/pix/dumdum/jpg $ # /new/pix/stupid.gif $ # /old/art/dumdum2.jpg $ #/old/art/stupid2.gif $ ... Notice that all FILES have unique names and the tag chars are mot part of the names. The go to the top of list and give find and replace thing and tell itntop
Code: [Select]Find # Replace copy then go to top again and do Find $ Replace G:\ where G: is the location of a empty USB stick. This lines now has the form: copy /new/pix/dumdum/jpg G:\ save the list file with a .BAT extension INSTEAD of the .TXT Now just execute the BAT file one time only. This method is slow, but you see what you are doing and it is rather safe. If the list of folders is like this:
cars apple boats boats 2
Then you can use this:
where d:\main\folder\ is where the folders are located and e:\target\ is where they are being copied to.
Code: [Select]@echo off for /f "delims=" %%a in (filelist.txt) do XCOPY "d:\main\folder\%%a" "e:\target\%%a\" /s/h/e/k/f/c
|