Recent Posts
None | 5 sec ago
PHP | 6 sec ago
None | 12 sec ago
None | 22 sec ago
None | 39 sec ago
Python | 1 min ago
PHP | 2 min ago
None | 2 min ago
CSS | 2 min ago
None | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 10th of Feb 2010 12:04:10 AM Download | Raw | Embed | Report
  1. #!/usr/bin/python
  2.  
  3. #       ./backup_script.py filetobackup localdirectory backupname
  4. # example:
  5. #       ./backup_script.py /code/ /home/target/ example
  6.  
  7.  
  8. import datetime
  9. import time
  10. import ftplib
  11. import os
  12. import sys
  13.  
  14. filetobackup = sys.argv[1]
  15. localdirectory = sys.argv[2]
  16. backupname = sys.argv[3]
  17. today = datetime.date.today()
  18.  
  19. command = 'tar czf ' + localdirectory,backupname + '-' + today + '.tar.gz ' + filetobackup
  20.  
  21. os.system(command)
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: