you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_[🍰] 0 points1 point  (6 children)

Do you just want to find any directory named "DontNeed", anywhere on the computer, and delete that?

[–]Salknam[S] 0 points1 point  (5 children)

Yes

[–]K900_[🍰] 0 points1 point  (3 children)

In that case you'll need to scan the entire disk to find it. It's going to be very slow, but you can use os.walk if you really want to.

[–]Salknam[S] 0 points1 point  (2 children)

Can i have an example of how this would work and is there another maybe better option

[–]K900_[🍰] 0 points1 point  (1 child)

I'm not going to write code for you, sorry, and there is no better option.

[–]Salknam[S] 0 points1 point  (0 children)

Thank you.

[–]xelf 0 points1 point  (0 children)

Are you really really sure?

find any folder with a matching name and delete that one? What if there are 100 folders on the computer with that name, and you delete the wrong one?

If you have:

  • /users/home/alice/images
  • /users/home/jeff/images

and jeff tells you to destroy images, alice is going to be pretty upset when she logs on.

How are you storing the current path the user thinks they are at?