0

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

2
  • 1
    You are a total beginner and you wrote that code? Kudos. You can start improving it by naming some variables in a more readable manner. (can somebody help me improve the previous sentence?) Commented Dec 24, 2010 at 10:02
  • Actually I started using python last week. I started with A Byte of python tutotial By Swaroop CH Commented Dec 24, 2010 at 10:05

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the suggestion, I will rewrite the script using these moduls.
2

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.

3 Comments

Thanks for the suggestion, I will rewrite the script using this module
This is a very nice suggestion, you code would probably be just a few line if you use it correctly. Functions are being very long (if not too long) here because of all the parsing.
Yes, the functions are unnecessarily long. I will definitely use these suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.