WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: fhammer on March 22, 2016, 11:34:24 PM

Title: Copy entire directory
Post by: fhammer on March 22, 2016, 11:34:24 PM
What is the best way to copy an entire directory (including all subdirectories and files)?

Thank you.
Title: Re: Copy entire directory
Post by: snowsnowsnow on March 23, 2016, 03:51:49 AM
XCOPY

Or, for the more industrious, you can Google, download, analyze, and deploy something called "XXCOPY".
Title: Re: Copy entire directory
Post by: JTaylor on March 23, 2016, 05:14:48 AM
Yes. XCOPY is a good option.  If you need a WinBatch solution for some reason there is one in the Tech Database.   Can't recall the best words to search on though to find it.     Maybe "File Copy Recursion" or some variation?

Jim
Title: Re: Copy entire directory
Post by: td on March 23, 2016, 08:12:21 AM
The Shell Operations extender's 'aFileCopy' is another option.
Title: Re: Copy entire directory
Post by: morenos1 on March 23, 2016, 09:03:45 AM
Sell Operations Extender "aFileCopy" function should do it .....
Title: Re: Copy entire directory
Post by: fhammer on March 23, 2016, 05:34:03 PM
Thanks for the responses. I think aFileCopy in the Shell Op extenter is probably what I need. I have installed it and am experimenting. However, I am having trouble understanding it and getting it to do what I want.

Maybe someone could help with a simple code example. Here is what I'm trying to do:

I have a directory on my desktop named WB_DEV. It has many levels of subdirectories and lots of files in each. All I'm trying to do (from within a WinBatch script) is make an exact copy of WEB_DEV on a thumb drive. The same result as if I had right-click-dragged the folder between two open file-explored windows, and chose "Copy Here".

More specifically, if

a = "C:\Users\fhammer\Desktop\WB_DEV"        ; path to WB_DEV directory
b = "D:\"                                                         ; path to tumb drive root

What statement (or statements) will get me what I want.

Thanks again for any help you can give me.

Title: Re: Copy entire directory
Post by: td on March 24, 2016, 07:23:32 AM
Have you read the help file documentation for the 'aFileCopy' function?   If so, try a few things on a couple of test directories you create and you should be able to figure it out.
Title: Re: Copy entire directory
Post by: fhammer on March 24, 2016, 02:13:36 PM
Yes, I had read the help file and had done some experimenting. I did not find the help file to be very helpful. Maybe that's because I'm using an older (2005C-compatible) version of the DLL & help. Reading about DOS XCOPY on the web helped. I was eventually able to get it to do what I want via trial-and-error. And I do feel guitly for not doing more experimenting before posting the topic.

Thanks for responding and helping!
Title: Re: Copy entire directory
Post by: td on March 24, 2016, 05:38:19 PM
AFileCopy can certainly do exactly what you describe in your original post so I am not sure why you couldn't get it to work for you unless there is something else about what you are attempting that you did not mentioned.