2008年9月16日火曜日

iPod music backup script


#!/usr/bin/env python
# -*- coding: utf-8 -*-

### globals
import os
import shutil

def swapextensions(copy_from, copy_to):
count = 0
for path, subdirs, files in os.walk(copy_from):
for file in files:
if file[:1] != '.':
count += 1
shutil.copy('%s/%s'%(path,file), '%s/%s'%(copy_to,file))

if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
print 'Usage: swapext rootdir before after'
sys.exit(100)
swapextensions(sys.argv[1], sys.argv[2])



how to use?

python copy_files.py /Volumes/xxx/iPod_Control/Music destination_path

0 件のコメント: