Commands Flashcards
1
Q
Remove a file
A
os.remove(‘file.txt’)
2
Q
Copy a file
A
shutil.copy(‘sourcefile.txt’, ‘newfile.txt’)
3
Q
Move a file
A
shutil.move(‘oldfile.txt’, ‘newfile.txt’)
4
Q
Copy a directory
A
shutil.copytree(‘olddir’, ‘newdir’)
5
Q
Remove a directory
A
shutil.rmtree(‘dir’)