Last active
August 29, 2015 14:25
-
-
Save dpastoor/fc1092b8437cbda1ede6 to your computer and use it in GitHub Desktop.
compare files between folders python
This file contains hidden or 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
| ******************* | |
| import os | |
| file_list1 = [] | |
| file_list2 = [] | |
| for top, dirs, files in os.walk('./'): | |
| for nm in files: | |
| file_list1.append(nm) | |
| for top, dirs, files in os.walk('/Users/<user>/Music/iTunes/iTunes Media/Music/'): | |
| for nm in files: | |
| file_list2.append(nm) | |
| songs1 = [file for file in file_list1 if file.endswith( ('.mp3','.m4a', '.m4p') ) ] | |
| songs2 = [file for file in file_list2 if file.endswith( ('.mp3','.m4a', '.m4p') ) ] | |
| set1 = set(songs1).difference(songs2) | |
| set2 = set(songs2).difference(songs1) | |
| print "files only in itunes media:" | |
| print set2 | |
| … |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment