删除linux中复制目录的问题

时间:2022-09-06 15:40:16

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.

好吧所以我使用“$ sudo cp -r”,现在我无法删除复制的目录。当我使用rm -r它问我是否要“删除写保护目录”,当我输入“y”时它表示权限被拒绝。

1 个解决方案

#1


1  

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;

如果你想消除“删除写保护目录”这类消息(报告它是写保护的)你可以使用-f选项,如@klashxx所说。 f强有力地说。即;

 $sudo rm -rf "filename"

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

r代表递归删除,(也删除目录中的文件,用于删除文件夹)

f stands for forcefully

f代表强有力

#1


1  

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;

如果你想消除“删除写保护目录”这类消息(报告它是写保护的)你可以使用-f选项,如@klashxx所说。 f强有力地说。即;

 $sudo rm -rf "filename"

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

r代表递归删除,(也删除目录中的文件,用于删除文件夹)

f stands for forcefully

f代表强有力