Sign in to follow this  
Followers 0
Nynjardin

DirCopy strange result

4 posts in this topic

Hi there,

I perform a DirCopy and nothing happen

Here my code: 

Quote

DirCopy("Data", @MyDocumentsDir, $FC_OVERWRITE)

 

I Use windows 10, and that not work even I start the .exe in admin mode... 

Data folder is in the same folder as the AutoIt executable. If the Data folder is already present in Documents, that change nothing...

If I copy/paste the folder manually, all work fine

For some test, I do this:

Quote

Run("7za.exe x -y ""DataDocs.7z"" -o" & @MyDocumentsDir)

And that not work too! I got an error in 7za who say "Unsuported method" but I found nothing to help for the 7z case... and in my destination folder, I only have files with 0Ko. All files and subfolders are present, but all files are empty!

If you have any idea...

Thanks a lot!

Share this post


Link to post
Share on other sites



If I do that:

Quote

 

$err = DirCopy("Data", @MyDocumentsDir, $FC_OVERWRITE)
msgbox(0,"er",$err)


 

I got error "o"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

@Nynjardin,

welcome to AutoIt and to the forum!

first, your command means to copy the content of "Data" into your Documents folder, not the "Data" folder itself (with its contents). this is a bit confusing, i admit; you'll need to get used to that. you need to create the target folder first. there is no permissions issue.

second, assuming the script dir is your current working directory is not reliable. make yourself a general practice, to provide the absolute paths when handling files. this is actually easier than you think.

third, the return value of DirCopy is not the error status - it's quite the opposite, that is 1=success and 0=failure. look at the help file.

finally, when posting code to the forum, use the code tags (the  < >  toolbar icon), like this:

#include <FileConstants.au3>
Global $sSubDir = '\dummy'
DirCreate(@MyDocumentsDir & $sSubDir)
$iResult = DirCopy(@ScriptDir & $sSubDir, @MyDocumentsDir & $sSubDir, $FC_OVERWRITE)
ConsoleWrite('DirCopy result (1=success,0=failure) = ' & $iResult & @CRLF)

 

 

Edited by orbs

Share this post


Link to post
Share on other sites

Hi orbs,

Thanks for your answer! It's correct, all my data files was directly in Documents folder (with a lot of other files, so, I don't see it at first sight)

 

I follow your advise now, thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0