Inconsistency in FileCopyDir documentation

Share your ideas as to how the documentation can be improved.
duncanpt
Posts: 1
Joined: 18 Nov 2019, 10:46

Inconsistency in FileCopyDir documentation

Post by duncanpt » 18 Nov 2019, 11:31

I think there is an inconsistency - if not an actual contradiction - in the documentation of the FileCopyDir command. It appears to say both that it WILL and WILL NOT recurse through a folder structure. See pasted text below, with my bold emphasis. Please let me know if I am missing something subtle. Otherwise might it be amended?

Thanks.

Remarks
If the destination directory structure doesn't exist it will be created if possible.

Since the operation will recursively copy a folder along with all its subfolders and files, the result of copying a folder to a destination somewhere inside itself is undefined. To work around this, first copy it to a destination outside itself, then use FileMoveDir to move that copy to the desired location.

FileCopyDir copies a single folder. To instead copy the contents of a folder (all its files and subfolders), see the examples section of FileCopy.

gregster
Posts: 9095
Joined: 30 Sep 2013, 06:48

Re: Inconsistency in FileCopyDir documentation

Post by gregster » 18 Nov 2019, 12:29

I think you are misunderstanding the docs. You have to distinguish between a folder and its contents.

At first, we learn:
FileCopyDir recurses (if possible - if it doesn't lead to undefined behaviour).
It accepts only a single source folder.

https://www.autohotkey.com/docs/commands/FileCopyDir.htm#Remarks wrote:FileCopyDir copies a single folder. To instead copy the contents of a folder (all its files and subfolders), see the examples section of FileCopy.
The last line has a different focus: FileCopyDir copies one folder (that it recurses while doing that, we already know, it was already mentioned twice; this is its normal behaviour), but if you just want to copy all the contents of that folder (all files and folders), not the folder itself, then use that FileCopy example instead.

Copy (the whole) folder x versus enter folder x and copy all its contents, that means, all files and folders inside folder x.
Do you see the difference between FileCopyDir and the FileCopy example #2 ? This is what the last sentence in the remarks section is about, that difference.

Btw, the so-called Filecopy example also uses FileCopyDir itself to copy any folders it finds (again, with recursion, if possible).

Post Reply

Return to “Suggestions on Documentation Improvements”