First of all, I'm not looking for an answer on how to remove the files. I am looking for a reason why this doesn't work – and a suggestion on how to remove the files without sudo.
I have a directory in my Desktop that has a few inner directories (don't judge the naming – I just extract what I need from files I'm given) and after getting the files I try and remove the files with rm -rf Bengal\ Tiger\ Creative/
, I am surprised to see the following warning for each image.
rm: cannot remove ‘Bengal Tiger Creative/Bengal Tiger Creative/images/customer-services-landscape.jpg’: Permission denied
Below is some code outputs.
tree
nathan@nathan-pc:~/Desktop$ tree
.
├── Bengal Tiger Creative
│ └── Bengal Tiger Creative
│ └── images
│ ├── awards.jpg
│ ├── blank.gif
│ ├── bullet1-light-green.gif
│ ├── bullet2-light-green.gif
│ ├── bullet3-light-green.gif
│ ├── bullet4-light-green.gif
│ ├── customer-services-landscape.jpg
│ ├── desktop.ini
│ ├── header-img1.jpg
│ ├── header-img2.jpg
│ ├── header-img4.jpg
│ ├── header-img5.jpg
│ ├── softhr.gif
│ ├── Thumbs.db
│ ├── tiger_main-img1.jpg
│ ├── tiger_main-img2.jpg
│ ├── tiger_main-img3.jpg
│ ├── tiger_main-img4.jpg
│ ├── Vanquis-benefits-icons_iphone-green.gif
│ └── white-arrow-green.gif
ls -laR
nathan@nathan-pc:~/Desktop$ ls -laR Bengal*
Bengal Tiger Creative:
total 12
drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 .
drwxr-xr-x 6 nathan nathan 4096 Aug 10 11:34 ..
drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 Bengal Tiger Creative
Bengal Tiger Creative/Bengal Tiger Creative:
total 12
drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 .
drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:30 ..
dr-xr-xr-x 2 nathan nathan 4096 Aug 10 11:36 images
Bengal Tiger Creative/Bengal Tiger Creative/images:
total 356
dr-xr-xr-x 2 nathan nathan 4096 Aug 10 11:36 .
drwxrwxr-x 3 nathan nathan 4096 Aug 10 11:34 ..
-rwxrwxrwx 1 nathan nathan 14910 Mar 18 12:29 awards.jpg
-rw-rw-r-- 1 nathan nathan 1093 Mar 21 2014 blank.gif
-rw-rw-r-- 1 nathan nathan 1978 May 8 2014 bullet1-light-green.gif
-rw-rw-r-- 1 nathan nathan 1969 May 8 2014 bullet2-light-green.gif
-rw-rw-r-- 1 nathan nathan 2416 May 8 2014 bullet3-light-green.gif
-rw-rw-r-- 1 nathan nathan 2449 May 8 2014 bullet4-light-green.gif
-rw-rw-r-- 1 nathan nathan 113138 Apr 14 2014 customer-services-landscape.jpg
-r--r--r-- 1 nathan nathan 142 Mar 25 11:58 desktop.ini
-rw-rw-r-- 1 nathan nathan 14312 Mar 23 11:39 header-img1.jpg
-rw-rw-r-- 1 nathan nathan 1480 Mar 23 11:41 header-img2.jpg
-rw-rw-r-- 1 nathan nathan 1278 Mar 23 11:41 header-img4.jpg
-rw-rw-r-- 1 nathan nathan 1168 Mar 23 11:41 header-img5.jpg
-rw-rw-r-- 1 nathan nathan 1703 Mar 21 2014 softhr.gif
-rw-rw-r-- 1 nathan nathan 88064 Aug 4 10:39 Thumbs.db
-rw-rw-r-- 1 nathan nathan 23607 Mar 23 11:56 tiger_main-img1.jpg
-rw-rw-r-- 1 nathan nathan 23400 Mar 23 11:56 tiger_main-img2.jpg
-rw-rw-r-- 1 nathan nathan 6970 Mar 23 11:56 tiger_main-img3.jpg
-rw-rw-r-- 1 nathan nathan 8996 Mar 23 11:57 tiger_main-img4.jpg
-rw-rw-r-- 1 nathan nathan 275 Jul 31 2014 Vanquis-benefits-icons_iphone-green.gif
-rw-rw-r-- 1 nathan nathan 1821 Jul 9 2014 white-arrow-green.gif
Doing chmod 777 and then delete does not work.
Doing rm -rf * inside the directory does not work.
Doing sudo rm file does work.
I can easily remove these files using sudo, however, I cannot see why they cannot be removed without sudo. As a relatively new Ubuntu user, I would like to learn why.
Thanks in advance,
Nathan
Best Answer
See this line?
You have no writing permissions for
images
directory.This can be fixed by
from the parent directory.