2

Say I have a list of filenames like these,

file01.001
file02.abc
fiAl.12x

ect. All with full extensions.

They are all in the main folder C:\ABC. Some files will be in subfolders or even in subsubfolders.

1) What's the quickest way to use this list and copy all files into one single folder, say D:\myfolder?

2) How to copy all files in the list, but also preserve the folder structure?

Thanks!

10
  • We are not a script writing service. We expect users to tell us what they have tried so far (including any scripts they are using) and where they're stuck so that we can help with specific problems. Questions that only ask for scripts are too broad and are likely to be put on hold or closed. Please read How do I ask a good question?. – DavidPostill Feb 21 '16 at 17:49
  • @DavidPostill I know you are not a "script writing service". I am only suggesting that something like a script that might be really easy. I have deleted the line where specifically says "I want a .bat script." I believe the rest of the post has two specific problems. – Chen Stats Yu Feb 21 '16 at 18:17
  • Right. Then you better start learning. - for /f - Loop command against the results of another command - would be a good start. – DavidPostill Feb 21 '16 at 18:31
  • - copy - Copy one or more files to another location. – DavidPostill Feb 21 '16 at 18:32
  • - dir - Display a list of files and subfolders. – DavidPostill Feb 21 '16 at 18:33
3

Take a look at this : XCOPY Syntax

Example : To copy a folder including all subfolders

XCOPY C:\ABC\* D:\myfolder /s /i

/S Copy folders and subfolders

/I If in doubt always assume the destination is a folder e.g. when the destination does not exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.