-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (17 loc) · 728 Bytes
/
main.py
File metadata and controls
21 lines (17 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
This script was for deleting duplicates which had (1) at the end in the Google Photos
takeout.
"""
import os
from os import path
# folderPath = input("Enter your value: ")
# print(folderPath)
for subdir, dirs, files in os.walk("/Users/abhimanyu/Google Drive/Photos/Family Photo Collection"):
for file in files:
# print os.path.join(subdir, file)
filepath = subdir + os.sep + file
if filepath.endswith(" (1).JPG") or filepath.endswith(" (1).jpg"):
originalFilePath = filepath.replace(" (1)", "")
if path.exists(originalFilePath) and open(filepath, "rb").read() == open(originalFilePath, "rb").read():
print(filepath)
os.remove(filepath)