From: TGAPE! <tgape@cyberramp.net>
To: zsh-users@math.gatech.edu
Subject: Re: backing up with zsh
Date: Sat, 18 Apr 1998 09:36:39 +0000 (GMT) [thread overview]
Message-ID: <199804180936.JAA08808@dal-tsa19-60.cyberramp.net> (raw)
In-Reply-To: <199804172020.PAA27672@kenku.warthog.com> from "Rob Windsor" at Apr 17, 98 03:20:29 pm
Rob Windsor wrote:
> Verily did Sven Guckes write:
>
>> I am trying to use the zsh to back my webpages.
>> I just want to backup text files, ie no pictures.
>
>> They webpages all reside in "~/.P". The pictures are within ~/.P/pics/ -
>> excluding this one dir is not a problem, but the problem is that some of
>> the pictures are scattered across the subdir of ~/.P still.
>> How do I exclude these pictures?
>
>> Possible filename extensions for pictures are: bmp gif jpg jpeg
>> But how do I specify these as case insensitive?
>> Do I have to list all possible combinations of upper- and lowercase spelling?
<snip&splice>
>> I may also need a restriction for file size (for all files), say 100K at
>> most.
>
> possibly.
>
> A good start would be:
>
> cd ~/.P ; find . -type f \! \( -name '*.gif' -a -name '*.jpg' -a -name '*.jpeg' -a -name '*.bmp' \) -print | xargs cvvzf /tmp/guckes.web.980417.tar.gz
A better start would be:
gtar czf /tmp/guckes.web.980417.tgz `cd ~/.P; find *(D) \! -type d -size 101k \
\! \( -iname '*.gif' -o -iname '*.jpg' -o -iname '*.jpeg' -o \
-iname '*.bmp' \) -print`
Also, this is larger (though more efficient, I hate to admit) than the
zsh
gtar czf /tmp/guckes.web.19980418.tgz \
**/*~*.([Gg][Ii][Ff]|[bB][mM][pP]|[jJ][pP][gG]|[jJ][pP][eE][gG])(DL-102401)
which is already fairly insane. (Of course, I use find jobs more
complicated than that every few months or so. However, I'm trying to
get some stars for my blue pointy hat.)
Hmm...
cd ~/.P;for x in **/*(DL-102401^/)
do
if [ $(file $x |grep -c picture) -eq 0 ]; then
tar cf - $x
fi
done | gzip -9 > /tmp/guckes.web.`date +%Y%m%d`.tgz
would be much more general; it's more keystrokes, though, and it'll run
slower than a siamese cat pulling a 1-ton stone block up a pyramid.
(Well, OK, maybe not *quite* that slow, but pretty damn slow.)
zsh is fairly resistant to the 'line too long' problem, it takes a
fairly large expansion to trigger it, and some cases appears to be
completely licked.
If you really need multiple v options to gtar, I'm not the guy you need
to talk to, I don't have a couch.
Uh,
~/.P;for x in **/*(D)
do
if [ $x != ${x#pics} && $(file $x | grep -c picture) -gt 0 ]; then
n=pics/${x##*/}
ln $x $n
for y in **/*(D.)
do
sed "s@$x@$n@g" $y > /tmp/nopics.$$
mv /tmp/nopics.$$ $y
done
rm $x
fi
done
should go a long way to moving all your pictures and fixing your links.
Other people's links, however, are another matter. I would suggest
backing up your webpage (probably including pictures this time) before
hazarding it. (If you're curious about the ln followed by rm, I work in
a 24x7x365 environment, where second outages can be costly.)
Ed
next prev parent reply other threads:[~1998-04-18 15:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-17 19:56 Sven Guckes
1998-04-17 20:20 ` Rob Windsor
1998-04-18 9:36 ` TGAPE! [this message]
1998-04-18 18:08 ` Bart Schaefer
[not found] ` <vkzphkchu4.fsf@cdc.noaa.gov>
1998-04-17 20:42 ` Sven Guckes
[not found] ` <vkyax4cgur.fsf@cdc.noaa.gov>
1998-04-17 21:00 ` Sven Guckes
1998-04-18 0:44 ` Perl and ZSH (WAS: Re: backing up with zsh) tep
1998-04-17 21:24 ` Bart Schaefer
1998-04-18 10:53 ` Perl and ZSH Jonas Bofjall
1998-04-18 9:53 ` TGAPE!
1998-04-18 18:21 ` Bart Schaefer
1998-05-04 23:47 ` Zsh and CVS Scott RoLanD
1998-04-18 10:13 ` backing up with zsh Mirar
1998-04-20 8:47 ` Andrew Main
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=199804180936.JAA08808@dal-tsa19-60.cyberramp.net \
--to=tgape@cyberramp.net \
--cc=zsh-users@math.gatech.edu \
/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).