zsh-users
 help / color / mirror / code / Atom feed
* how to either ignore or deal with Icon$'\r' files on macOS
@ 2019-06-21  0:04 TJ Luoma
  2019-06-21  1:26 ` Ray Andrews
  2019-06-21  1:38 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: TJ Luoma @ 2019-06-21  0:04 UTC (permalink / raw)
  To: zsh-users

I never thought I'd hate anything more than the .DS_Store files that
macOS makes, but it turns out there's something much worse:

Icon$'\r'

These are some kind of file that is uses to give a special icon to a
folder when viewed in the Finder, but the files themselves aren't
visible in Finder (why they didn't make them '.icon' files, I have no
idea).

Most of the time I can just ignore them, but I've run into one folder
where I need to be able to do something like

for i in *
do
      whatever
done

but I do NOT want to do whatever if "$i" is one of these stupid Icon$'\r' files.

The problem is that I can't figure out how to match it.

for i in *
do
    if [ "$i" != "Icon$'\r'" ]
    then
        echo "$i"
    fi
done

doesn't work. It will echo "Icon" without the last character(s).

I don't even know what to try to match, because it shows up as that
weird "$'\r'" thing, but not if I do `ls`

% /bin/ls -l Icon$'\r'
-rw-rw-rw-@ 1 luomat  staff  0 Jun 20 18:42 Icon?

and if I run `ls` through `cat -v` I get this:

%  /bin/ls -l | fgrep -i icon | cat -v
-rw-rw-rw-@ 1 luomat  staff          0 Jun 20 18:42 Icon^M

I don't even know how to `rm` it reliably and safely, and macOS will
just re-generate it anyway, so it felt like it was time to figure out
how to properly ignore it.

Any suggestions welcome.

Tj

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Twitter: @tjluoma

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-21  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21  0:04 how to either ignore or deal with Icon$'\r' files on macOS TJ Luoma
2019-06-21  1:26 ` Ray Andrews
2019-06-21  1:38 ` Bart Schaefer
2019-06-21  8:20   ` Roman Perepelitsa

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).