Backup a directory
clp at rebertia.com
Wed Oct 1 00:00:06 CEST 2008
On Tue, Sep 30, 2008 at 1:21 PM, <dudeja.rajat at gmail.com> wrote:
> I'm looking for a script that creates a backup of a directory but keeps only
> one backup.
> I've tried using all the os modules commands but could not create one.
> Does any one has any such custom script or function?
You could probably whip one up very easily using the tarfile module
[http://docs.python.org/lib/module-tarfile.html] and shutil.move()
[http://docs.python.org/lib/module-shutil.html]. Just make a new
TarFile of the directory, save it, then replace any previous backup
file using shutil.move()
Good luck, and have fun!
P.S. And if you're on *nix, you might consider just using a shell
script and the 'tar' command. Right tool for the right job and all
Follow the path of the Iguana...
> Thanks and regards,
More information about the Python-list