Say the path of the file \'file1.txt\' is /home/bentley4/Desktop/sc/file1.txt Say my current working directory is /home/bentley4
/home/bentley4/Desktop/sc/file1.txt
/home/bentley4
i
I was working on the same issue and I found this, hope it helps you:
os.path.join(root, f)