It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/python
#Backup.py
#Written by Chroniccommand to stop Wezo from bitching about the size of Duplicity
'''
Documentation: RTFM!
This script simply tars up a directory. Tar means compress, so it will compress all the files into a simple tar file.
To restore, untar the file and mv the files to where they're supposed to go.
Example:
backtar /home/chronic /mnt/external
'''
import sys, os, datetime
def usage():
print(\"Usage:\n%s </file/to/backup/> </path/to/backup/to>\" % sys.argv[0])
sys.exit()
if len(sys.argv) != 3:
usage()
def backup(backfile, path):
curdate = datetime.datetime.now()
filename = curdate.strftime(\"%Y-%m-%d%H%M\")
print(\"Backing up. Please wait....\")
backfilename = \"backup-%s\" % filename
tar = (\"tar -zcf %s %s\" % (backfilename, path))
os.system(tar)
mv = (\"mv %s %s\" % (backfilename, path))
os.system(mv)
print(\"Backup complete\")
sys.exit()
backfile = sys.argv[1]
path = sys.argv[2]
backup(backfile, path)
#!/usr/bin/python
#Backup.py
#Written by Chroniccommand to stop Wezo from bitching about the size of Duplicity
'''
Documentation: RTFM!
This script simply tars up a directory. Tar means compress, so it will compress all the files into a simple tar file.
To restore, untar the file and mv the files to where they're supposed to go.
This version is GUI using wxPython
'''
import sys, os, datetime
try:
import wx
except ImportError:
print(\"wxPython module not found! This is required\")
sys.exit()
class frame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self,parent,id,'BackTar GUI', size=(300, 200))
panel = wx.Panel(self)
box = wx.TextEntryDialog(None, \"Path to backup\", \"BackTar GUI\", \"\")
if box.ShowModal() == wx.ID_OK:
backfile = box.GetValue()
print backfile
box2 = wx.TextEntryDialog(None, \"Path to backup to\", \"BackTar GUI\", \"\")
if box2.ShowModal() == wx.ID_OK:
path = box2.GetValue()
print path
wx.MessageBox('Backing up. Please wait(Press OK to continue)....', 'Info')
print(\"Message from system: Please wait. Backing up....\")
self.backup(backfile, path)
def backup(self, backfile, path):
global entry
curdate = datetime.datetime.now()
filename = curdate.strftime(\"%Y-%m-%d%H%M\")
print(\"Backing up. Please wait....\")
backfilename = \"backup-%s\" % filename
tar = (\"tar -zcf %s %s\" % (backfilename, path))
os.system(tar)
mv = (\"mv %s %s\" % (backfilename, path))
os.system(mv)
print(\"Backup complete\")
sys.exit()
app = wx.PySimpleApp()
frame = frame(parent=None, id=-1)
frame.Show()
app.MainLoop()