Jump to content

DirCopy strange result


Recommended Posts

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!

Link to comment
Share on other sites

@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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...