TheTwister
Posts: 18
Joined: Fri Dec 29, 2017 6:39 pm

Permissions folders within folders

Wed Jan 16, 2019 8:07 pm

I have a folder with multiple folders inside and i want to delete the main one With everything inside it.
How can i do this? Without giving every folder permissions.

User avatar
Paeryn
Posts: 3171
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Permissions folders within folders

Wed Jan 16, 2019 9:59 pm

TheTwister wrote:
Wed Jan 16, 2019 8:07 pm
I have a folder with multiple folders inside and i want to delete the main one With everything inside it.
How can i do this? Without giving every folder permissions.
You can forcibly remove a directory and all its contents regardless of who owns individual files by doing so as root. Be warned, this is dangerous as if you give the directory wrong you could potentially wipe the entire filesystem.

This will delete /home/pi/dir_to_remove and all its contents.

Code: Select all

$ sudo rm -rf /home/pi/dir_to_remove
The options to rm tell it to recursively descend into directories and to forcibly remove entries without prompting (otherwise rm will ask you what to do if it encounters problems like not having write permission for a particular file). The sudo at the start says you want to run the command as root rather than the current user, sudo is needed if any files or directories are not owned by the user (or otherwise not editable by the user) else rm won't be able to delete them.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

Return to “Beginners”