I'm working with Python and have to move files from a folder to its sub-folder. I tried using shutil.move(), but it gives an error:
Cannot move a directory '%s' into itself
Here's the code:
for file in your_files:
if file in images:
shutil.move(your_folder, images_folder)
elif file in docs:
shutil.move(your_folder, docs_folder)
elif file in texts:
shutil.move(your_folder, texts_folder)
else:
shutil.move(your_folder, others_folder)
images_folder, docs_folder, texts_folder and others_folder are all sub-folders of your_folder.
How do I move files from your_folder to the corresponding sub-folders?