Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to either ignore or deal with Icon$'\r' files on macOS
- X-seq: zsh-users 23975
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: how to either ignore or deal with Icon$'\r' files on macOS
- Date: Thu, 20 Jun 2019 20:04:32 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=PlGRsFtCt6XXN93WeK1tyzug2kSlckAm5iQ3TK8Ni0E=; b=khHAnBbvCyosLxsBJIlBfP0xUSdpvr5vcNB7fhcYN+cgb64/9j8iobR1LZwCOwa7AJ EZDT5tKk2N1KrmPQqjapiqHVNBo1+p0jFgl/zq5P0w91hPlOBmPQuujsPY9Ipd8eumdC vEc89wK2UXmJx4SQWUCQPbk+TrHCyF58GPvTNqMCdvQ+UWcr47Ak6b3TqmF4yU0Edg+M wMERIWzxWJZD2SzELQ9DesylXn1FzRKIztXhENrfrWG7RykzNTb9d4SvdSrrT+YOMqqb pg/4ccFtUXi54ypMcaaNPz77Soc4aZw7emjzgPQIo1Hq/ZpKB3iTC5jAB7nlE1hd6NCo s8CQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author