"cannot remove 'some_directory': Directory not empty"

when i try to remove directory /run/media/user/usb_name/.Trash-1000 using rm commnde it give me the following output :

rm: cannot remove '.Trash-1000/files/.thunderbird': Directory not empty

It is, as the message says, a directory (a folder) with other stuff in it
rm -r
(remove recursively)
this will prompt you for each and every file that is there
rm -rf
will skip these questions and just do what you asked, no matter what or how many, how much is in there

Be very sure that you really want that, there is no coming back from this!

… or just use the file manager and empty the trash …

1 Like

thank you for reply i try all the the commande you mentioned above but no result

I did not provide full commands (and intentionally so).
I just told you how to use the command’s switches, altering how it behaves.

the difference is in
rm (what you used)
rm -r (to remove recursively)

The former will only delete the one specific file (which you didn’t specify)
It will not let you delete a directory with other files and directories still in it.

The latter will recursively delete the directory and everything in it.

man rm
will tell you about these and other switches and what they do

i get you bro it does not work

Just empty the trash can using your file manager.

If you want to be be more surgical/selective, as is appears to be the case
and want to remove everything inside:

rm -rf /run/media/user/usb_name/.Trash-1000/files/.thunderbird/*
(note the asterisk at the end)

The effect will be:
the directory
will still be there - but it will be empty - all the files that where in it will be gone for good

… of course, that path is not real (which is a good thing)
because the “usb_name” and the “user” part of it is something you … redacted

I wonder why you’d, let’s say: insist
in using the raw command line.
Which you clearly do not know how to use.

Why not just use a file manager?
It would make the task so much easier - and you’d actually see the directory structure that you are dealing with.

“mc” is a good one, if you want to stay in the terminal
(you have to first install it - it’s not there by default)

In case you did not know:
what you are trying to do here is
deleting something from the trash can - something that has already been deleted - but is still there in the trash
and can be “resurrected” any time
You are trying to delete some of the already deleted stuff
so that it cannot be brought back.

The same issue happened to me today trying to delete a directory in an usb disk. There were errors in the file system that prevented me from doing that. Use Gparted to verify the filesystem on the usb stick.

but the reason the OP can’t delete what they want to is not because of filesystem errors - but because of not understanding how to do what they want to do
The commands don’t work for them because both the command as well as the path is incorrect.

1 Like

May be, but if the path is wrong the error message should be “directory not found”, not “directory not empty” (it seems he also tryed ‘rm -rf’), that was what made me think it was the same issue I had today… :thinking:

first post
he tried to remove a directory
and was told that it wasn’t empty

Me saying what I said was just a summary of of what I saw them doing and why that failed …

Why not let them figure it out?
I explained it as best I could.

1 Like

You would want to keep that folder: Trash management - ArchWiki
As @Nachlese said earlier, you would rather want to use your file manager instead to empty the trash.

1 Like

I think it will be recreated sometime after he deleted it becaus the system does need it. :rofl:
And at the right time he will learn that files starting with a dot belong to the system. And that it may do harm to his system when he interferes with them at his own will.

The system can also be a beast :wink:

man rm

but this file is created in USB after deleting something from it and for my situation i dont want the file to be created because it allow the recover deleted file

The Trash directory won’t be created if you don’t use your graphical file manager.
Which is likely not the route you want to go.

It simply being there doesn’t mean that something you delete can be recovered.
Just don’t put it in the trash bin in the first place.

There is always an option to “really delete” whatever.
Usually you hold down “CTRL” or “Shift” while you select and delete something
which will then be directly and permanently deleted.

You may have to first enable the presence of this option in the settings of your file manager.
But I don’t know the file manager used in LXQT and where to find that option in it’s settings.

i am using thunar file manger

The menu on top:
Edit → Preferences → third Tab (Behavior) → the check box at the bottom (Context Menu)

i will take it in consideration for future thank you

But be aware that even without “.Trash” it is often possible to recover deleted files if you know how to do it (especially on USB, when the filesystem is FAT).

search for “photorec”

I had kinda hoped that no one would go there, to mention that rabbit hole :grin: