The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

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
⇧ Prevent automatic reboot after Ubuntu Core update on 16.xx How do I stress test CPU and RAM (at the same time)?  β‡©