Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Python for File Systems!
You have completed Python for File Systems!
Preview
Often we find it necessary to delete files and directories. We'll look at some ways to accomplish these frequent and important tasks.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In fact, I might have done more deletion
than creation even since, quite often,
0:00
files get added through
version controller or
0:00
user uploads, and
then I need to clean them up with Python.
0:02
So let's look at how to delete files and
directories with Python.
0:05
But be warned,
Python deletes items immediately.
0:08
The files won't be moved to the users
trash or any equivalent location.
0:11
We'll look at a handy third-party library,
though, named Send2Trash,
0:14
that will help us avoid this behavior.
0:17
We're gonna look at three different
functions for removing things and,
0:20
unfortunately, you kinda have
to know all three of them.
0:24
They each do different things and
0:27
you'll often need to use at
least two of them together.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up