I was downloading videos on the internet and decided to also practice my coding skills while I'm at it, so I made a python script to help me organize files. As you can see, the current function does do what I want it to do to an extent, but I can't figure out a method to just find just Folders and not try to make every single file into a directory which results in the code crashing.
def pullout():
for files in os.listdir():
movehere = filepath
newpath = filepath + "\\" + files
#print(newpath)
os.chdir(newpath)
for files in os.listdir():
if files.endswith(".mp4"):
shutil.move(files, movehere)
filepath = input("Enter file path\n")
os.chdir(filepath)
To find all types of video files I guess I'll just add more in the endswith() like .wmv, .flv, .avi, etc.
Folders have no file extension which is a way to identify them but can't find a method that helps with that so that's useless.