user3595626
user3595626

Reputation: 1

Problems with deleting a copied directory in linux

ok so i used "$ sudo cp -r" and now I cant delete the copied directory. When I used rm -r it asked me if I wanted to "remove write-protected directory" and when I type "y" it says permission denied.

Upvotes: 0

Views: 99

Answers (1)

Sorcrer
Sorcrer

Reputation: 1644

Since you've copied the file with superuser privilege, you'll need superusers privilege to delete the file Try the

 $sudo rm -r "filename"

so that the file gets deleted

If you want to eliminate "remove write-protected directory" these kind of messages (reporting it is write-protected) you can use -f option with it as @klashxx said. f means forcefully. ie;

 $sudo rm -rf "filename"

r stands for recursively deletion,(also delete files within the directory ,used for deleting folders )

f stands for forcefully

Upvotes: 1

Related Questions