From: TJ Luoma <luomat@gmail.com>
To: zsh-users@zsh.org
Subject: how to either ignore or deal with Icon$'\r' files on macOS
Date: Thu, 20 Jun 2019 20:04:32 -0400 [thread overview]
Message-ID: <CADjGqHt0p7Mohed9Ge80HidT93Q5Mc-DuKdKuzd-vrVGyMmQSQ@mail.gmail.com> (raw)
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
next reply other threads:[~2019-06-21 0:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 0:04 TJ Luoma [this message]
2019-06-21 1:26 ` Ray Andrews
2019-06-21 1:38 ` Bart Schaefer
2019-06-21 8:20 ` Roman Perepelitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADjGqHt0p7Mohed9Ge80HidT93Q5Mc-DuKdKuzd-vrVGyMmQSQ@mail.gmail.com \
--to=luomat@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).