Jump to content

DirCopy issue


orbs
 Share

Recommended Posts

I looked at the following post:

http://www.autoitscript.com/forum/index.php?showtopic=91249

someone wants to copy a directory structure without overwriting files that exist in both source and destination.

GEOsoft suggested using DirCopy, but the guy tested it and it did not work for him.

I tried it myself, and he's right. DirCopy (with flag 0, by default) does NOT work for me.

here's what I did:

1. create a source folder "D:\TestZone\dircopy\src" and put a file there, and a subfolder with another file inside

2. create and run the following script:

DirCopy("D:\TestZone\dircopy\src","D:\TestZone\dircopy\dst")

Exit

it worked, and now the dst folder is identical to src folder

3. create a new file in "D:\TestZone\dircopy\src" and another in the subfolder within.

4. rerun the script.

i expected the new files to be copied to the dst folder.

guess what ? nothing happened ! the folders are still identical.

5. just in case there are any syntax errors or miswritten path strings, I rerun the script with the flag set to 1:

DirCopy("D:\TestZone\dircopy\src","D:\TestZone\dircopy\dst",1)

Exit

it worked, but it copied everything again.

am I doing something wrong, or is the DirCopy (without overwrite in existing destination folder) just does not work ?

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

hmmm... what makes you think that ? It doesn't seem to make any sense...

anyway, if it is so, how can it be useful for understanding or troubleshooting the issue with DirCopy ?

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

Firstly, because AutoIt uses a lot of these native Windows calls to do the "older functions" such as DirCopy.

Second because the parameters are exactly the same.

Third because the description of the CopyFile function matches that of the DirCopy function.

Fourth because it doesn't make any sense to write your own if you can do a simple Windows function call.

That aside, it is useful for understand the issue with DirCopy because you can now try to understand the issue with CopyFile and you have made the problem language independant. Which usually means someone else having the same issue in another language.

Also, FileCopy function excludes directories. But it is the default method for copying directories.

Link to comment
Share on other sites

thanks for the explanation and the logic behind it,

but I'm not too keen on making this a global issue. I could have my script run external command (i.e. robocopy) to solve my problem - which is that DirCopy does not do what the manual says it should do.

either my script is faulty, or there's something wrong - or not properly documented - in the command itself.

(BTW the command DirRemove is also poorly documented - by default, it is meant to remove directories only if empty. I needed to figure that one out for myself. not that I dislike learning by trying, but couldn't they just say it ?)

so, this is a question for the development team of AutoIt - is DirCopy working or not, in the described conditions ?

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...