Hi, I need to copy the CD-ROM content (files and folder) to a directory on the local hard disk.
I saw the filecopydir syntax (Copies a folder along with all its sub-folders and files (similar to xcopy), https://www.autohotkey.com/docs/commands/FileCopyDir.htm but it doesn't work...
This is my script:
FileCopyDir, E:\, C:\New folder
But when i Run the script, nothing happens... If I use FileCopy instead of FileCopyDir it works, only for the files of the main directory.
Copy files and folder issue
Re: Copy files and folder issue
Code: Select all
source = D:
target = %A_MyDocuments%\test\
If FileExist(target) {
MsgBox, 48, Error, Target directory already exists. Aborting.`n`n%target%
Return
} Else FileCopyDir, %source%, %target%
If ErrorLevel
MsgBox, 48, Failure, An error occurred while copying the directory. Aborting.
Else MsgBox, 64, Success, Done!
Re: Copy files and folder issue
Thank YOU!mikeyww wrote: ↑29 Jul 2021, 08:52Code: Select all
source = D: target = %A_MyDocuments%\test\ If FileExist(target) { MsgBox, 48, Error, Target directory already exists. Aborting.`n`n%target% Return } Else FileCopyDir, %source%, %target% If ErrorLevel MsgBox, 48, Failure, An error occurred while copying the directory. Aborting. Else MsgBox, 64, Success, Done!
I don't know why it needs to create a sub folder, but it's ok for my goal.
Re: Copy files and folder issue
You could always write a separate routine that uses FileCopy instead, but it would require more coding (but not a lot more)!