Created
January 24, 2014 09:30
-
-
Save vinu76jsr/8594481 to your computer and use it in GitHub Desktop.
A Python script to move mp3 files from one directory to a flat structure in another directory, Uses path.py module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A Python script to move mp3 files from one directory to a | |
flat structure in another directory | |
Uses path.py module | |
""" | |
import os | |
from path import path | |
DIRECTORY = '/Users/vaibhav/Desktop/msc' # music source Directory | |
COPY_DIRECTORY = '/Users/vaibhav/Desktop/msc_copy' # Destination directory | |
d = path(DIRECTORY) | |
copy_directory = path(COPY_DIRECTORY) | |
def transfer(): | |
print "Copying Files from %s to %s" % (d, copy_directory) | |
file_count = 0 | |
for i in d.walk(): | |
if i.isfile() and i.endswith('mp3'): | |
file_count += 1 | |
print "Copying %s" % i | |
# i.copy(copy_directory) | |
print 'Transferred %s files' % file_count | |
if __name__ == "__main__": | |
transfer() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment