Ok so I have written a simple Python code that compares all the files in 2 folders and deletes the duplicates from one of them. I've been using it for a few weeks now and it all works fine on all my hard disks. But when I connected my phone, the os.walk does not seem to locate the address at all
Phone : Blackberry Key2 (android) Platform : Jupyter Notebook Issue : The phone when connected from USB appears to have missing a Drive Letter (see screenshot). I don't know what that means though.This PC screenshot I'm entering the path as it appears in my computer for the os.walk command but it won't read it
path2 = r"RG0005\BlackBerryBBF1006\Internal shared storage\Pictures"
I've tried searching the forums but I guess I don't know what a drive without a drive letter is called and couldn't find anything relevant
Any help is appreciated!! Thanks!
Code for python notebook:
import os
import pandas as pd
import csv
from datetime import datetime
pd.set_option('display.max_colwidth', 700)
#COMPARE THIS
path1 = r"F:\1_BBK1_20190623_Img_Bckup\1_Pictures"
#DELETE FROM PATH
path2 = r"RG0005\BlackBerryBBF1006\Internal shared storage\Pictures"
f1 = [] #path
f2 = [] #path
a1 = [] #filename
a2 = [] #filename
for root, dirs, files in os.walk(path1):
for file in files:
if (file.endswith(".jpg")
or file.endswith(".png")
or file.endswith(".jpeg")
or file.endswith(".mov")
or file.endswith(".mp4")
or file.endswith(".pdf")
or file.endswith(".xlsx")
or file.endswith(".txt")):
f1.append(os.path.join(root))
a1.append(os.path.join(file))
ds1 = {"Path":f1,"filename":a1}
df1 = pd.DataFrame(ds1)
for root, dirs, files in os.walk(path2):
for file in files:
if (file.endswith(".jpg")
or file.endswith(".png")
or file.endswith(".jpeg")
or file.endswith(".mov")
or file.endswith(".mp4")
or file.endswith(".pdf")
or file.endswith(".xlsx")
or file.endswith(".txt")):
f2.append(os.path.join(root))
a2.append(os.path.join(file))
ds2 = {"Path":f2,"filename":a2}
df2 = pd.DataFrame(ds2)
# df2.head()