doing a python tutorial and one of the assignments says to develop a program
that backsup files to zip files into a backup directory

im using Darwin 10.0.0 unix version:

this is what i came up with thus far, i did copy the sample program given
but made changes for my unix OS:

#!/usr/bin/env python
# Filename : backup_prog.py


import os
import time

source = '/Users/davidteboul/bin/python'

target_dir = '/Users/davidteboul/backups'

target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.gz'

zip_command = "gzip -qr {0} {1}".format(target, ' '.join(source))

if os.system(zip_command) == 0:
    print('Successful backup to', target)
else: print('Backup FAILED')


i ran it and my computer went nuts!..its started trying to gzip every file
on my computer...luckily it said access denied oneverything but i dont
understand why it would zip files that i didnt even specify..is it the 'r'
comman in the gzip command line that prompted this?
ill cut and paste partial piece of what came up in terminal:


gzip: /Users/davidteboul/backups/20091013134804.gz: No such file or
directory
gzip: //.file: Permission denied
gzip: //.fseventsd: Permission denied
gzip: //.hotfiles.btree: Permission denied
gzip: //.Spotlight-V100: Permission denied
gzip: //.Trashes: Permission denied
gzip: //Applications/Address
Book.app/Contents/_CodeSignature/CodeResources.gz: Permission denied
gzip: //Applications/Address Book.app/Contents/CodeResources: Too many
levels of symbolic links
gzip: //Applications/Address Book.app/Contents/Info.plist.gz: Permission
denied
gzip: //Applications/Address Book.app/Contents/MacOS/Address Book.gz:
Permission denied
gzip: //Applications/Address Book.app/Contents/PkgInfo.gz: Permission denied
gzip: //Applications/Address Book.app/Contents/Resources/AB16.png.gz:
Permission denied
gzip: //Applications/Address
Book.app/Contents/Resources/ABAccountsPreferencesModule.png.gz: Permission
denied
gzip: //Applications/Address
Book.app/Contents/Resources/ABCertificate.tiff.gz: Permission denied
gzip: //Applications/Address Book.app/Contents/Resources/AddButton.tif.gz:
Permission denied


but it went on for about 1000 lines if not more
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to