(Solved) Unable to delete folders

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read how to get help
Post Reply
Mazda81
Level 3
Level 3
Posts: 148
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

(Solved) Unable to delete folders

Post by Mazda81 » Mon Sep 02, 2019 5:00 am

I ran a backup using Grsync but cancelled because I was using the wrong external hard drive. Some folders were created that appear to be empty, nothing is found when hidden files are shown. When I try to delete these folders I get the error “cannot delete file:directory is not empty”.
I tried to use the terminal command rm -rf but I can’t get the path to the external drive correct. I get the error “too many arguments”. The drive is called Seagate Expansion Drive if that helps.
Any help would be appreciated.
Last edited by Mazda81 on Mon Sep 02, 2019 12:04 pm, edited 1 time in total.

User avatar
kc1di
Level 14
Level 14
Posts: 5343
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Unable to delete folders

Post by kc1di » Mon Sep 02, 2019 6:15 am

What else is on the Drive? if it was only used for your back up then the simplest way may be to just format it.
Other than that you will have to find the exact address of the drive and file to delete them. They are most likely seen a directories so you'll need to
use the command

Code: Select all

sudo rm -r <name of directory>
this will remove the directory even if it has files in it. so be careful.
Easy tips : https://easylinuxtipsproject.blogspot.com/
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608

Mazda81
Level 3
Level 3
Posts: 148
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: Unable to delete folders

Post by Mazda81 » Mon Sep 02, 2019 8:49 am

Thanks kc1di,
The drive has other data on so I can’t format. I tried your method but I can’t seem to get the right path. I right click on the folder and select properties which shows it’s location but when I copy that into the terminal it says “too many arguments”

User avatar
kc1di
Level 14
Level 14
Posts: 5343
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Unable to delete folders

Post by kc1di » Mon Sep 02, 2019 9:22 am

Please post the file name/address you get from Properties.
What are the permission of that directory also.
Easy tips : https://easylinuxtipsproject.blogspot.com/
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608

User avatar
pbear
Level 8
Level 8
Posts: 2194
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Unable to delete folders

Post by pbear » Mon Sep 02, 2019 11:14 am

I'd try ejecting the external drive, then remounting it.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Mazda81
Level 3
Level 3
Posts: 148
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: Unable to delete folders

Post by Mazda81 » Mon Sep 02, 2019 11:52 am

The path to the folder is /media/andrew/Seagate Expansion Drive
The folder is called andrew and it contains several empty sub-folders. I have permission to create and delete this folder although it was created by Grsync.
I tried mounting the drive on another machine with the same results.
I typed the command rm -rf /media/andrew/Seagate Expansion Drive/andrew into the terminal but nothing happened.

Mazda81
Level 3
Level 3
Posts: 148
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: (Solved) Unable to delete folders

Post by Mazda81 » Mon Sep 02, 2019 12:10 pm

I just found a simple solution. If I right-click on the folder and select delete I get the error message but if I highlight the folder and press delete on the keyboard it deletes as normal! Why that should be I don't know.
Thanks

ajgreeny
Level 4
Level 4
Posts: 428
Joined: Mon Nov 19, 2007 3:27 pm

Re: Unable to delete folders

Post by ajgreeny » Mon Sep 02, 2019 3:58 pm

Mazda81 wrote:
Mon Sep 02, 2019 11:52 am
The path to the folder is /media/andrew/Seagate Expansion Drive
The folder is called andrew and it contains several empty sub-folders. I have permission to create and delete this folder although it was created by Grsync.
I tried mounting the drive on another machine with the same results.
I typed the command rm -rf /media/andrew/Seagate Expansion Drive/andrew into the terminal but nothing happened.
The problem here is the spaces in the pathway /media/andrew/Seagate Expansion Drive/andrew which must be "escaped" for the command to work; the easiest way to do this is to put the whole pathway in quotes, ie, "/media/andrew/Seagate Expansion Drive/andrew"

Simply using the Del key as mentioned in your last post may simply put the folders into the USB disk's own trash; you can see if that's the case by using Ctrl+H to show all hidden files and folders and looking for the Trash folder. Some systems remove USB disk's trash when it is unmounted but I'm not sure if Mint does that.

Mazda81
Level 3
Level 3
Posts: 148
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: (Solved) Unable to delete folders

Post by Mazda81 » Mon Sep 02, 2019 5:39 pm

Thanks ajgreeny that's useful information. You're right the folders are in the trash file on the external drive in a folder named "expunged". Is it OK to delete the trash folder and if so how?

ajgreeny
Level 4
Level 4
Posts: 428
Joined: Mon Nov 19, 2007 3:27 pm

Re: (Solved) Unable to delete folders

Post by ajgreeny » Tue Sep 03, 2019 11:43 am

Yes, it's fine to delete the trash from an external drive, though I'm not sure whether you need to do that as root as I've never needed to do so.

If you have read/write permissions to the external drive it should be possible as user, ie, root not needed.

Post Reply

Return to “Other topics”