Score:0

Undeletable "Icon" file

ru flag

I have a strange problem with some files on my NAS that are not deletable, maybe remnants of some MacOS file copy.

They appear with filename "Icon" in file manager but as 'Icon'$'\r' with ls.

Permissions are 755 (but 700 if I check them from MacOS), and I tried to delete them using rm -f 'Icon'$'\r' to no avail, resulting in a "No such file or directory" error in terminal.

I tried to use chattr -i on them with the same results.

I even tried to delete them from MacOS but didn't work.

I absolutely need to get rid of them but I can't think to anything else, any help from Linux gurus?

pLumo avatar
in flag
With wildcard `rm Icon*` ?
lucaspeed avatar
ru flag
Yes, tried that. I tried almost everything with rm, I'm going crazy.
terdon avatar
cn flag
I'm afraid this is off topic here, since it isn't about Ubuntu, but is on topic on our sister site, [linux.se]. Please delete and repost there, but also include what `rm` commands you have tried and the exact error they gave you. `rm ./Icon*` should work, and so should `rm Icon?` or `find . -name 'Icon*' -delete`.
lucaspeed avatar
ru flag
I am actually on Ubuntu 20.04.1 so I think this is in topic here. But I will edit original post with all I tried (I receive everytime the same "No such file or directory" error)
paladin avatar
kr flag
Question, what filesystem is this? When possible, force a filesystem check. When possible, remount the volume with special mount options, which forbid non ASCII characters being used in a filename.
lucaspeed avatar
ru flag
I managed to delete those files using the file manager on Synology DSM. I usually use terminal for almost everything so I didn't think of it sooner.
Score:0
in flag

I encountered the same problem when rsync'ing files off my NAS. rsync would occasionally report...

file has vanished: "/Volumes/archives/blerg/Icon\#015"

Looking at the source, a zero byte Icon? file was still present and couldn't be deleted.

$ ls -l
-rwx------  1 molomby  staff     0B  4 Sep  2020 Icon?

I tried:

$ rm 'Icon'$'\r'
rm: Icon\r: No such file or directory
$ rm Icon*    
rm: Icon\r: No such file or directory
$ find . -name 'Icon*' -delete
find: -delete: unlink(./Icon\r): No such file or directory

No joy.

A Solution:

In the end I just moved all the other files elsewhere and deleted the containing directory. It worked but surely there's a better way.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.