Created
June 27, 2019 12:39
-
-
Save arto-heino/de2691ae21e113ccfc08aa96e440ed99 to your computer and use it in GitHub Desktop.
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
list = os.listdir(path) | |
# Files are now named ssn_filename_uniqueid.filetype | |
# Set files to list ['filename','unique_id','file_type'] | |
def renameFiles(list): | |
name = [] | |
for filename in list: | |
name.append(re.split("(_\d*_\d*_\d*)", filename)) | |
return name | |
def getFiles(list): | |
filelist = renameFiles(list) | |
dupes = getDupes(filelist) | |
print(dupes) | |
# move duplicated files to different folder | |
# os.rename(filename, moveto+filename) | |
# Try to find all duplicate files and return them in list | |
# each[0] is the filename | |
def getDupes(list): | |
dup = [] | |
for each in list: | |
if each[0] in dup: | |
dup.append(each[0]) | |
return dup | |
getFiles(list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment