directory here is an example that searches through all the files in directory and prints the names of those files that contain the word 'helloimport os directory ' :/users/heinold/desktopfiles os listdir(directoryfor in filesif os path isfile(directory+ ) open(directory+fread(if 'hello in sprint(fchanging and deleting files here are few useful functions just be careful here function description mkdir create directory rmdir remove directory remove delete file rename rename file the first two functions take directory path as their only argument the remove function takes single file name the first argument of rename is the old name and the second argument is the new name copying files there is no function in the os module to copy files insteaduse the copy function in the shutil module here is an example that takes all the files in directory and makes copy of eachwith each copied file' name starting with copy of import os import shutil directory ' :/users/heinold/desktopfiles os listdir(directoryfor in filesif os path isfile(directory+ )shutil copy(directory+fdirectory'copy of '+fmore with os path the os path module contains several more functions that are helpful for working with files and directories different operating systems have different conventions for how they handle pathsand the functions in os path allow your program to work with different operating systems without having to worry about the specifics of each one here are some examples (on my windows system)print(os path split' :/users/heinold/desktop/file txt ')print(os path basename' :/users/heinold/desktop/file txt ')print(os path dirname' :/users/heinold/desktop/file txt ')