LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Removing folders from portable drive (https://www.linuxquestions.org/questions/linux-software-2/removing-folders-from-portable-drive-4175736578/)

Igor Evgen 04-30-2024 09:52 AM

Removing folders from portable drive
 
On my portable Store Jet "Transcend" some folders (kept from previous OS Windows) got unmovable and unnecessary. How to remove them?
Normal way "move to trash" doesn't work (computer writes "error" or "the file is not empty").
Neither helps Beach Bit.
Terminal writes "no such file in directory" -- and what is a proper command?
Thank you.

pan64 04-30-2024 10:28 AM

what kind of filesystem is it? Probably would be better to save what you need and reformat the whole storage.
Without details hard to say more. There can be hidden or strange chars in filenames, there can be hardware error or corrupted filesystem or just a mistyped command. Or something else.

business_kid 04-30-2024 10:37 AM

I Presume this is a ntfs drive? Or is it udf?
Have you tried something like this?
Code:

mount /dev/nutty-drive /media
rm -ri /media/*

It should spit you up a confirmation dialogue for each directory. There's things like Recycle.Bin which is listed as /media/$Recycle.Bin, and that '$' has to be escaped, i.e.
rm -rf /path/to/\$Recycle.Bin

Igor Evgen 04-30-2024 12:55 PM

Quote:

Originally Posted by pan64 (Post 6499078)
what kind of filesystem is it? Probably would be better to save what you need and reformat the whole storage.
Without details hard to say more. There can be hidden or strange chars in filenames, there can be hardware error or corrupted filesystem or just a mistyped command. Or something else.

Thanks for replying. My filesystem is Ubuntu 22.04 LTS. I think about reformatting too. Just hope for some sudo rm or unknown to me Linux tool which kicks whatsoever.

PS Another strange thing is that to get an answer from this forum, I have to (get out and) reenter it. Otherwise, it feels like nobody give a damn.

Igor Evgen 04-30-2024 01:25 PM

Quote:

Originally Posted by business_kid (Post 6499080)
I Presume this is a ntfs drive? Or is it udf?
Have you tried something like this?
Code:

mount /dev/nutty-drive /media
rm -ri /media/*

It should spit you up a confirmation dialogue for each directory. There's things like Recycle.Bin which is listed as /media/$Recycle.Bin, and that '$' has to be escaped, i.e.
rm -rf /path/to/\$Recycle.Bin

Thanks. The code (if it's not a joke) didn't help.
Terminal answered: <special device /dev/nutty-drive does not exist>.
The "ntfs" it is.

The Transcend is a portable hard drive, StoreJet 25M3, USB 3.0.
When I open <hidden files>, it additionally shows
<.Trash-1000>.
The "stubborn" folder to be removed shows 4 folders, all responding as <the folder contents could not be displayed>.

So what, to reformat it?

business_kid 04-30-2024 01:39 PM

Quote:

Originally Posted by Igor Evgen
So what, to reformat it?

Back up all valuable data and make a new partition of your choice Ext4 is the all-purpose file system, but there are others with their own peculiar strengths. I stick with ext4 for the repair tools, and I don't fit any of the use cases for the more exotic distros.

yancek 04-30-2024 01:48 PM

Quote:

Terminal answered: <special device /dev/nutty-drive does not exist>.
THe 'nutty-drive' was an example so it is up to you to use or create a specific mount point wherever you wish but usually done in the /mnt or /media directories. Then you mount it.

Quote:

(computer writes "error" or "the file is not empty").
Was it actually 'folder is not empty'? Delete the sub-folders first. rm -rf dirname should do the job only if you have the full path to the correct directory or are in the directory immediately above the directory you want to remove.

Or do what is suggested in post 6 which might be simpler if you have no data there you want to save.

rokytnji 04-30-2024 02:10 PM

I reformatted my Toshiba 1TB drive that was NTFS to BTRFS file system because it lost everything stored in it while copying and pasting files from it.

Gparted handled that. I blame the NTFS file system for losing my backups. Now have only one from another laptop, but copy and paste.
Mount and dis mount. Work like they should.


All times are GMT -5. The time now is 06:51 AM.