hsinxh
hsinxh

Reputation: 1881

how can I improve this python script?

Backup Script

Please check the link above, I wrote this small script in python. It backup files from one directory to the other depends upon the user input. I want to know what are the limitations of this script and all the improvements that can be done to it. So that I can learn from my mistakes, I am total beginner to programming and python. Thanks

Upvotes: 0

Views: 89

Answers (2)

Antoine Pelisse
Antoine Pelisse

Reputation: 13099

First of all, you can replace all os.system (either mk_d, or tar) by pythonic commands os.mkdir() (mkdir) and tarfile

Upvotes: 3

Martin Thurau
Martin Thurau

Reputation: 7644

Don't use raw_input, use command-line parameters. To do this use the optparse module (or argparse for Python 2.7+). Also the use of os.system is not recommented, see Replacing Older Functions with the subprocess Module for a replacement.

Upvotes: 2

Related Questions