(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 read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Mazda81
Level 3
Level 3
Posts: 191
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

(Solved) Unable to delete folders

Post by Mazda81 »

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 LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
kc1di
Level 18
Level 18
Posts: 8180
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Unable to delete folders

Post by kc1di »

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/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
Mazda81
Level 3
Level 3
Posts: 191
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: Unable to delete folders

Post by Mazda81 »

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 18
Level 18
Posts: 8180
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Unable to delete folders

Post by kc1di »

Please post the file name/address you get from Properties.
What are the permission of that directory also.
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Unable to delete folders

Post by pbear »

I'd try ejecting the external drive, then remounting it.
Mazda81
Level 3
Level 3
Posts: 191
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: Unable to delete folders

Post by Mazda81 »

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: 191
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: (Solved) Unable to delete folders

Post by Mazda81 »

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 7
Level 7
Posts: 1662
Joined: Mon Nov 19, 2007 3:27 pm

Re: Unable to delete folders

Post by ajgreeny »

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: 191
Joined: Thu Aug 20, 2015 8:37 am
Location: UK

Re: (Solved) Unable to delete folders

Post by Mazda81 »

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 7
Level 7
Posts: 1662
Joined: Mon Nov 19, 2007 3:27 pm

Re: (Solved) Unable to delete folders

Post by ajgreeny »

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.
Locked

Return to “Other topics”