Hey there, I've been playing around with a WSH script that could do it for you. However, I need to know, are you using XP?
Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
/me reads first post yet again
Hmm. I don't know why I thought you were using windows.
In any case, this makes it a bit easier. I'll just use Tcl/Tk. Give me a day or two and I'll give you a you nice GUI script.
Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
Alright. Here you go.
#! /usr/bin/env wish
#
# userbackup.tcl
# Backup a directory as a tar.gz file
#
# Error checking is minimal.
#
package require Tk
proc main {} {
set done false
# (Don't show any windows except the dialogues)
wm withdraw .
while {!$done} {
#-------------------------------------------------------------------------
# Get the full path of the directory to backup
set dirname [tk_chooseDirectory \
-initialdir ~ \
-title {Select the directory you wish to backup} \
-mustexist true]
if {$dirname eq {}} {
# tk_messageBox -icon info -title {} -message Cancelled. -type ok
return
}
#-------------------------------------------------------------------------
# Generate a default filename
set basename [file tail $dirname]
if {$basename eq {}} {
tk_messageBox \
-icon info \
-title {} \
-message "You cannot backup '$dirname'" \
-type ok
continue
}
# (tack on the date and time)
set basename $basename.[clock format [clock seconds] -format %d-%m-%Y.%H%M]
#-------------------------------------------------------------------------
# Ask for the place to save the backup
set filename [tk_getSaveFile \
-filetypes {{{Tar-gzipped files} {.tar.gz}}} \
-initialdir ~ \
-initialfile $basename \
-title {Select the backup filename}]
if {$filename eq {}} {
# tk_messageBox -icon info -title {} -message Cancelled. -type ok
return
}
# (make sure the filename ends in either .tgz or .tar.gz)
set ext [file extension $filename]
if {($ext ne {.tgz}) && ($ext ne {.tar.gz})} {
set filename $filename.tar.gz
}
# (make sure that the backup file isn't to be placed in any directory
# being backed up)
if {[string first \
[file normalize $dirname]/ \
[file normalize $filename]] == 0} {
tk_messageBox \
-icon error \
-title {} \
-message {Your backup file cannot be in the directory being backed up (or any subdirectory).} \
-type ok
continue
}
#---------------------------------------------------------------------
# Actually DO the backing up
exec tar czf $filename $dirname
#---------------------------------------------------------------------
# Ask if there are more folders to backup
set ans [tk_messageBox \
-icon question \
-title {} \
-message {Do you wish to backup another directory?} \
-type yesno]
set done [expr {$ans eq {no}}]
}
}
main
# end
This should work on any platform that has Tcl/Tk installed. Since you are using Fedora linux I forsee no problems.
Tcl code is pretty simple, so you can change things as you see fit. The stuff of greatest interest are where you see -initialdir
and the actual backup command: tar czf $filename $dirname
This of course requires that yourtar command understands the z option. If it doesn't (because it is ancient), just split the commands:
if {[file extension $filename] eq {.tgz}} \
then { set filename [file rootname $filename].tar } \
else { set filename [file rootname $filename] }
exec tar cf $filename $dirname
exec gzip $filename
Enjoy!
Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229