Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os, os.path, shutil
- def sortcopy(src, dst):
- for entry in sorted(os.listdir(src), key=lambda x: x.lower()):
- fullsrc = os.path.join(src, entry)
- fulldst = os.path.join(dst, entry)
- if os.path.isdir(fullsrc):
- if not os.path.exists(fulldst):
- os.mkdir(fulldst)
- sortcopy(fullsrc, fulldst)
- else:
- print fulldst
- shutil.copyfile(fullsrc, fulldst)
- sortcopy('/home/hstubbe/Music/', '/media/USBSTICK/')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement