be careful when using move(finallythe folders that make up the destination must already existor else python will throw an exception enter the following into the interactive shellshutil move('spam txt'' :\\does_not_exist\\eggs\\ham'traceback (most recent call last)--snip-filenotfounderror[errno no such file or directory' :\\does_not_exist\eggs\\hampython looks for eggs and ham inside the directory does_not_exist it doesn' find the nonexistent directoryso it can' move spam txt to the path you specified permanently deleting files and folders you can delete single file or single empty folder with functions in the os modulewhereas to delete folder and all of its contentsyou use the shutil module calling os unlink(pathwill delete the file at path calling os rmdir(pathwill delete the folder at path this folder must be empty of any files or folders calling shutil rmtree(pathwill remove the folder at pathand all files and folders it contains will also be deleted be careful when using these functions in your programsit' often good idea to first run your program with these calls commented out and with print(calls added to show the files that would be deleted here is python program that was intended to delete files that have the txt file extension but has typo (highlighted in boldthat causes it to delete rxt files insteadimport os from pathlib import path for filename in path home(glob('rxt')os unlink(filenameif you had any important files ending with rxtthey would have been accidentallypermanently deleted insteadyou should have first run the program like thisimport os from pathlib import path for filename in path home(glob('rxt')#os unlink(filenameprint(filename