Views:
5,694β
Votes: 2β
Tags:
delete
bleachbit
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/949468
Title:
Can't delete empty directories with strange names
ID:
/2017/08/24/Can_t-delete-empty-directories-with-strange-names
Created:
August 24, 2017
Edited: June 12, 2020
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
Graphical method
I would use nautilus
the file manager built into Ubuntu. Simply highlight the directories, right-click and select βsend to trashβ. If directories have large files you might want to empty trash right away.
If the directories are owned by root Nautilus wonβt let you delete them. In this case open a terminal and use:
gksu nautilus
Canβt move to trash but can delete directly
According to this Linux Mint question some Windows files canβt be moved to trash but can be deleted directly.
Another answer in this thread points out how to find out the file system type using:
df -T /media/<path_to_project_folder>
Then changing the /etc/fstab
entry worked for mounting using different parameters and successfully deleting the files.
Terminal Method
As per this Super User Q&A you can delete files with special characters (weird names) by changing to the directory containing them and using:
rm -i -- *
This will prompt you to delete each file. You can and should change β*β to a narrower match if there are a lot of files. The --
stops processing options, so a file named -d
will be removed by rm successfully.
Another answer in the same thread proposes deleting by inode number using. It says you can use ls -li
to show all files by their inode. Then run this command to remove the file:
find . -inum ${INODE_NUM} -delete
You can add -maxdepth 1
to my find just to be safe:
find . -maxdepth 1 -inum ${INODE_NUM} -delete