Sign in to follow this  
Followers 0
R.L.

Little File BackerUpper

13 posts in this topic

#1 ·  Posted (edited)

:huh2:

I wrote it because it was very hard to find a small tool that would backup individual files (mostly configuration files) from different locations to one location (typically a: drive). The script may not be as skillfully put together as some would be able to do so, but the little thing does the trick, hope some might find it useful (AutoIt is awsome!). Suggestions are welcomed.

Here is the script:

http://www.autoitscript.com/fileman/users/public/RL/FileBackerUpper.au3

Here is its home :D

Little(File)BackerUpper HomePage

Here is its screenshot (a bit different from the current version)

Little (File) BackerUpper Screenshot

And here is the complied package (for full features and version history, please read the readme file in the package):

FilebackerUpper062304b.zip

Edited by R.L.

Share this post


Link to post
Share on other sites



Kewl;

I wrote one that backups from the date of your choice and goes backwards to the number of days you set. Wrote it in autoit2 though and uses atool

Rick


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

cool deal, though one file at a time? can't select a directory?


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

cool deal, though one file at a time? can't select a directory?

I would love to make it being able to select multiple files at one time, but I still need to work it out with the file selection dialog box. Now, when I enable the feature to make multiple selections, the full paths of them are not captured. I may need to do some string manipulation in order to make it work. :D

As for directories, I'm afraid not.

This script was born exactly because one can so easily find freeware for backing up the whole directory (there are indeed numerious of them around), but almost none of them allow you to backup a list of individual files with different exts or from different directories. Hence, Little File BackerUpper it is :huh2:

(In fact, it is really not difficult to just write a few lines moving *.* or *.[ext] from one or several dirs to another, but that is not what this script is aiming at :lol: ).

It would, however, be nice to be able to enter more than one files at a time. Will try to work on it - tips on codes are welcomed :)

Share this post


Link to post
Share on other sites

cool deal, though one file at a time? can't select a directory?

Actually the autoit does the date manipulation and a bat file using xcopy or xxcopy runs the app. So you can copy anything you want by setting it up in the bat. I use fileattrib +a and xcopy /m with some other switches

Rick


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

was just looking at the guts a bit, msgbox timeouts are in seconds, not miliseconds...

MsgBox(64 + 0, "Backup canceled (timeout in 8 seconds) ", "Backup did not proceed due to user's cancel.", 8000)

Edit: just killing two birds with one post... I'm working on another bit of backup code, for defining wild card strings to have xcopy do recursive backups on... I'll post it when I get to work... the idea is to easily get all the *.au3 files backed up from a whole directory tree at once, perhaps, if you like it, we could find a way to build it into your gui?

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

was just looking at the guts a bit, msgbox timeouts are in seconds, not miliseconds...

MsgBox(64 + 0, "Backup canceled (timeout in 8 seconds) ", "Backup did not proceed due to user's cancel.", 8000)
ooooops :) Thanks for catching this. Use the functon SLEEP too often and got the unit mixed up.

  I'm working on another bit of backup code, for defining wild card strings to have xcopy do recursive backups on...  I'll post it when I get to work...  the idea is to easily get all the *.au3 files backed up from a whole directory tree at once, perhaps, if you like it, we could find a way to build it into your gui?

Sure, one more function of this wouldn't hurt :huh2:

Just in case some may wonder, my next goal is to build profile support, so users can call up different lists to backup :D

Edited by R.L.

Share this post


Link to post
Share on other sites

ooooops  :)  Thanks for catching this.  Use the functon SLEEP too often and got the unit mixed up.

Sure, one more function of this wouldn't hurt  :huh2:

Just in case some may wonder, my next goal is to build profile support, so users can call up different lists to backup :D

That's in my backup already although with au2

I just used fileselect and ran the batch as a var

Rick


Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ok, here it is, I'm sure to integrate it, you'd want to change the INI parts, replace them with your own. I'm using xcopy because it's got the handy recursing that I want...

if FileExists("backup.ini") = 0 Then
   EditIni("backup.ini")   
EndIf
$source = IniRead("backup.ini", "Config", "source","C:\")
$dest = IniRead("backup.ini", "Config", "destination","C:\")
$find = StringSplit(IniRead("backup.ini", "Config", "files", "*.au3,*.txt,*.bat"),",")
for $i = 1 to $find[0]
  ;MsgBox(0, "testing",@ComSpec & " /c xcopy "& $source & "\" & $find[$i] & " " & $dest & " /i /e /h /Y /D")
   $val = RunWait(@ComSpec & ' /c xcopy "'& $source & "\" & $find[$i] & '" "' & $dest & '" /i /e /h /Y /D /Z',@TempDir);/i assumes target is directory, /e copies directories - including empties, /h includes system and hidden, /Y overwrites, /d copies only files that have a newer date than those at the destination.
  ;MsgBox(0, "Program returned with exit code:", $val)
   if $val = 0 Then
     ;files coppied ok
   Else
     ;it was bad
   EndIf
   
Next

Func EditIni($ini)
   IniWrite($ini, "Config", "files",InputBox("simple backup","Type the parts of filenames that you'd like backed up, comma seperated."& @LF &_
         "You can use standard DOS wildcards",  "*.au3, *.txt, *.bat" ))
   IniWrite($ini, "Config", "source", FileSelectFolder("select folder to backup, backup does recurse.", "",0))
   IniWrite($ini, "Config", "destination", FileSelectFolder("Select drive or folder to copy files to.", "",1))
EndFunc  ;==>EditIni
Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

since au3checker was just updated, and I had your backerupper open, I checked it... there's a few errors you might want to look at:

FileBackerUpper.au3(432,21) : ERROR: $S: undeclared global variable.
            $S = $S +

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

ok, here it is, I'm sure to integrate it, you'd want to change the INI parts, replace them with your own.  I'm using xcopy because it's got the handy recursing that I want...

Hey, thanks, will see how I am going to put it together in the next version and will post it here after I finished :D

since au3checker was just updated, and I had your backerupper open, I checked it... there's a few errors you might want to look at:

FileBackerUpper.au3(432,21) : ERROR: $S: undeclared global variable.
            $S = $S +
Cool! You caught my leftovers (a variable I set out to have but didn't use) :huh2: ;

I wasn't aware of the checker, thanks, very neat feature! I cleaned up the script a bit and uploaded a new version (Following a suggestion from Jon in another thread, I use CASE SELECT for stating control function instead of IF, THEN :

http://www.autoitscript.com/fileman/users/public/RL/filebackerupper.au3

Share this post


Link to post
Share on other sites

ok, here it is, I'm sure to integrate it, you'd want to change the INI parts, replace them with your own. I'm using xcopy because it's got the handy recursing that I want...

if FileExists("backup.ini") = 0 Then
   EditIni("backup.ini")   
EndIf
$source = IniRead("backup.ini", "Config", "source","C:\")
$dest = IniRead("backup.ini", "Config", "destination","C:\")
$find = StringSplit(IniRead("backup.ini", "Config", "files", "*.au3,*.txt,*.bat"),",")
for $i = 1 to $find[0]
  ;MsgBox(0, "testing",@ComSpec & " /c xcopy "& $source & "\" & $find[$i] & " " & $dest & " /i /e /h /Y /D")
   $val = RunWait(@ComSpec & ' /c xcopy "'& $source & "\" & $find[$i] & '" "' & $dest & '" /i /e /h /Y /D /Z',@TempDir);/i assumes target is directory, /e copies directories - including empties, /h includes system and hidden, /Y overwrites, /d copies only files that have a newer date than those at the destination.
  ;MsgBox(0, "Program returned with exit code:", $val)
   if $val = 0 Then
     ;files coppied ok
   Else
     ;it was bad
   EndIf
   
Next

Func EditIni($ini)
   IniWrite($ini, "Config", "files",InputBox("simple backup","Type the parts of filenames that you'd like backed up, comma seperated."& @LF &_
         "You can use standard DOS wildcards",  "*.au3, *.txt, *.bat" ))
   IniWrite($ini, "Config", "source", FileSelectFolder("select folder to backup, backup does recurse.", "",0))
   IniWrite($ini, "Config", "destination", FileSelectFolder("Select drive or folder to copy files to.", "",1))
EndFunc  ;==>EditIni

I use xxcopy for mine, but I am having problems running on a Vista PC... Does xcopy work on a Vista PC? Thanks!

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