speedi Posted January 27, 2010 Posted January 27, 2010 (edited) 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 January 27, 2010 by speedi
PsaltyDS Posted January 27, 2010 Posted January 27, 2010 What have you tried? Are you familiar yet with _FileListToArray(), FileGetAttrib(), etc.? 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
jreardon Posted January 27, 2010 Posted January 27, 2010 Have you tried robocopy? It is now bundled with Vista by default, and I guarentee you will love it. Watch out for that Mirror command, that WILL bite you if you are not carefull.
speedi Posted January 27, 2010 Author Posted January 27, 2010 What have you tried? Are you familiar yet with _FileListToArray(), FileGetAttrib(), etc.?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!
PsaltyDS Posted January 27, 2010 Posted January 27, 2010 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). 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
James Posted January 27, 2010 Posted January 27, 2010 #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 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
speedi Posted January 27, 2010 Author Posted January 27, 2010 #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?
James Posted January 27, 2010 Posted January 27, 2010 Did I miss something?No, I did. So just add a nice little check inside the loop. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
speedi Posted January 27, 2010 Author Posted January 27, 2010 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...
James Posted January 27, 2010 Posted January 27, 2010 Well what attributes are you looking for in the file? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
PsaltyDS Posted January 27, 2010 Posted January 27, 2010 (edited) If you had just listened to the penguin... I mean, look at the blue guy's eyes -- tell me he's not stoned! 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! Edited January 27, 2010 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
speedi Posted January 27, 2010 Author Posted January 27, 2010 If you had just listened to the penguin... I mean, look at the blue guy's eyes -- tell me he's not stoned! 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! I will be doing penance for days!!!! Fortunately I have a very good backup arrangement with duplicity.... You are right, I was STUPID!
James Posted January 27, 2010 Posted January 27, 2010 I'd say sorry for not warning you, but honestly, live data... Lesson learnt So what attributes are you looking for in each file? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now