Backup a directory

Chris Rebert clp at rebertia.com
Tue Sep 30 18:00:06 EDT 2008


On Tue, Sep 30, 2008 at 1:21 PM,  <dudeja.rajat at gmail.com> wrote:
> Hello,
>
>
> 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!

Regards,
Chris

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
that.

-- 
Follow the path of the Iguana...
http://rebertia.com

>
>
> Thanks and regards,
> rajat
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list