Jump to content

autoit commands to replace xxcopy


speedi
 Share

Recommended Posts

I currently use xxcopy to copy files in my docs and sub dirs with the archive bit set. They are copied to a destination for backup. I rotate the destination to 4 different folders. The xxcopy works fine in winxp, but not in win Vista. I have not been able to find autoit commands to do the same thing. xxcopy also has an option for an exclude files list. Any help with autoit commands to do this would be greatly appreciated...

My xxcopy command line and comments:

; XXCOPY will copy all files that have changed or been created since last time it was run....

Run("C:\WINDOWS\SYSTEM32\XXCOPY.EXE " & chr(34) & @MyDocumentsDir & CHR(34) & ' '& chr(34) & $thedir & CHR(34) & ' /cr45/M/C/S/Y/WV0/oNc:\backup.txt/oF3/oP0/exC:\exclude.txt')

; added /cr45 switch to do retry for 45 seconds if copy fails

; following code necessary because xxcopy function above requires licensed version for /oF3 option

; consequently the command pauses for a user response.

; "/exC:\exclude.txt" added 3/17/2005 to exclude certain folders

Edited by speedi
Link to comment
Share on other sites

What have you tried? Are you familiar yet with _FileListToArray(), FileGetAttrib(), etc.?

:D

Just now tried _FileListToArray() but can't see how to use FileGetAttrib() with it since FileGetAttrib() works off the disk and the array only has names.... Did I miss something? Thanks!

Link to comment
Share on other sites

Use a recursive function to walk through the directory tree, using _FileListToArray() with each of the directories, and checking the attributes on each file with FileGetAttrib(). This assumes you want to write something in AutoIt.

As jreardon pointed out, Robocopy is available and very powerful (dangerously so, be careful).

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

:D

#include <File.au3>

$srcFolder = @DesktopDir ; Folder you wish to copy
$desFolder = @HomeDrive & "\backup" ; Folder you wish to move files to
$aFiles = _FileListToArray($srcFolder)

For $i = 1 To UBound($aFiles) - 1
    FileMove($srcFolder & '\' & $aFiles[$i], $desFolder & '\' & $aFiles[$i], 9)
Next
Link to comment
Share on other sites

:D

#include <File.au3>

$srcFolder = @DesktopDir ; Folder you wish to copy
$desFolder = @HomeDrive & "\backup" ; Folder you wish to move files to
$aFiles = _FileListToArray($srcFolder)

For $i = 1 To UBound($aFiles) - 1
    FileMove($srcFolder & '\' & $aFiles[$i], $desFolder & '\' & $aFiles[$i], 9)
Next

I understand that, but looks like it copies all files without regard to the archive attribute...

Did I miss something?

Link to comment
Share on other sites

No, I did. So just add a nice little check inside the loop.

Wow! Did I screw up. I did not pay attention to your script command that was filemove and not filecopy... The files in the sub dirs of mydocs are now deleted... The destination has a file with the folder name, but they are not "file folders". The size seems to indicate the data is there, but I can't find any way to make those files "file folders" the properties type just says "file".... I hope you can help me with that...

Link to comment
Share on other sites

If you had just listened to the penguin... I mean, look at the blue guy's eyes -- tell me he's not stoned!

:huggles:

Edit: @speedi: All seriousness aside; did you really download a script of a forum and then run it against your live system's data? I think you need to come back tomorrow with a 2-page essay for the class on why that's a BAD IDEA!

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If you had just listened to the penguin... I mean, look at the blue guy's eyes -- tell me he's not stoned!

:huggles:

Edit: @speedi: All seriousness aside; did you really download a script of a forum and then run it against your live system's data? I think you need to come back tomorrow with a 2-page essay for the class on why that's a BAD IDEA!

:D

I will be doing penance for days!!!! Fortunately I have a very good backup arrangement with duplicity.... You are right, I was STUPID!

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