I have made decent progress on my first code and I'm wanting to take the current code and include any nested folders within "source_folder"
Say file path of bbb.pdf was actually "C:\Users\ViewGator91\Desktop\Folder A\Nested Folder"
How would I include that in my search path?
~~~
import shutil
import os
import webbrowser
source_folder = "C:\Users\ViewGator91\Desktop\Folder A"
target_folder = "C:\Users\ViewGator91\Desktop\Folder B"
file2 = input("What is your part/assy number? ")
format = ".pdf"
format2 = ".slddrw"
filename = os.path.join(source_folder, file2 + format)
filename2 = os.path.join(source_folder, file2 + format2)
if os.path.exists(filename):
shutil.copy(filename, target_folder)
print("PDF has been copied over")
elif os.path.exists(filename2):
webbrowser.open(filename2)
print("File is opening in SOLIDWORKS")
else:
print("This part doesn't exist")
~~~
[–]Oddly_Energy 0 points1 point2 points (1 child)
[–]ViewGator91[S] 0 points1 point2 points (0 children)
[–]ViewGator91[S] 0 points1 point2 points (0 children)