On Sat, Jan 04, 2003 at 09:51:21PM -0500, Fraser Campbell wrote:
> On January 4, 2003 09:20 pm, the fabulous Gerald V. Livingston II wrote:
>
> > Thank you. Took a couple of tries to get the syntax correct but I
> > ended up with this:
> >
> > if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ]
> >
> > then
Colin Watson <[EMAIL PROTECTED]> [2003-01-05 13:46:32 +]:
> > find . -maxdepth 1 -name '*.jpg' -print | head -n 1 | grep -q .
>
> -q already stops at the first match, so there is no need to do this.
[I had to check. ;-) The option -q sets done_on_match and the code
quits at the first chanc
On Sun, 5 Jan 2003, Mark Zimmerman wrote:
> Yes, but that's not all. Setting MATCH=*.jpg does not seem to trigger
> the globbing function in bash, to my surprise. The following does
> work, though:
>
> shopt -s nullglob
> MATCH=$(printf %s *.jpg)
> if [ -n "$MATCH" ]; then SOME=TRUE; else SOME=FA
On Sun, Jan 05, 2003 at 04:13:49AM +, Colin Watson wrote:
> On Sat, Jan 04, 2003 at 06:58:18PM -0700, Mark Zimmerman wrote:
> > shopt -s nullglob
> > SOME=FALSE
> > MATCH=*.jpg
> > for f in $MATCH; do SOME=TRUE; break; done
> >
> > I tried [ -z $MATCH ] also but it always fails even though ech
On Sat, Jan 04, 2003 at 09:55:42PM -0700, Bob Proulx wrote:
> Colin Watson <[EMAIL PROTECTED]> [2003-01-05 04:04:19 +]:
> > > And I've bumped into this. How *DOES* one test for the existence of
> > > ANY file with a given extension without getting a "too many arguments"
> > > error when there a
Colin Watson <[EMAIL PROTECTED]> [2003-01-05 04:04:19 +]:
> > And I've bumped into this. How *DOES* one test for the existence of
> > ANY file with a given extension without getting a "too many arguments"
> > error when there are multiple files?
>
> How about:
>
> find . -maxdepth 1 -name '
Colin Watson said:
>> Took a couple of tries to get the syntax correct but I
>> ended up with this:
>>
>> if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ]
>>
>> then for i in *.jpg; do mmv "$i" `date +%s`-$a.jpg; a=a+1; done
>>
>> fi
>
> In general it's better to avoid putting backticks in the middle of
Fraser Campbell <[EMAIL PROTECTED]> [2003-01-04 21:51:21 -0500]:
> On January 4, 2003 09:20 pm, the fabulous Gerald V. Livingston II wrote:
>
> > Thank you. Took a couple of tries to get the syntax correct but I
> > ended up with this:
> >
> > if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ]
> > then for
On Sat, Jan 04, 2003 at 08:20:18PM -0600, Gerald V. Livingston II wrote:
> Jamin W. Collins said:
> > On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II
> > wrote:
> >> I want "TRUE" if there is one or more zzz.jpg files in a directory,
> >> "FALSE" if there are zero of them.
> >
> >
On Sat, Jan 04, 2003 at 06:58:18PM -0700, Mark Zimmerman wrote:
> shopt -s nullglob
> SOME=FALSE
> MATCH=*.jpg
> for f in $MATCH; do SOME=TRUE; break; done
>
> I tried [ -z $MATCH ] also but it always fails even though echo $MATCH
> prints an empty string.
You probably need to double-quote "$MATC
On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II wrote:
> Colin Watson said:
> > On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
> >> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg";
> >> done fi
> >
> > That -e test looks dreadful ... surely it'll usua
On January 4, 2003 09:20 pm, the fabulous Gerald V. Livingston II wrote:
> Thank you. Took a couple of tries to get the syntax correct but I
> ended up with this:
>
> if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ]
>
> then for i in *.jpg; do mmv "$i" `date +%s`-$a.jpg; a=a+1; done
>
> fi
If there were
Hi,
"Gerald V. Livingston II" <[EMAIL PROTECTED]> writes:
> Colin Watson said:
>
>> On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
>>> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg";
>>> done fi
>>
>> That -e test looks dreadful ... surely it'll usually expand to lo
Jamin W. Collins said:
> On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II
> wrote:
>
>> I want "TRUE" if there is one or more zzz.jpg files in a directory,
>> "FALSE" if there are zero of them.
>
> Assuming you don't want the names of the files, just whether they are
> there or no
05.01.2003 02:00:03, "Gerald V. Livingston II" <[EMAIL PROTECTED]> wrote:
>I want "TRUE" if there is one or more zzz.jpg files in a directory,
>"FALSE" if there are zero of them.
One solution might be:
ls | grep -q '\.jpg$'
Cheers, Michael
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with
On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II wrote:
> Colin Watson said:
>
> > On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
> >> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg";
> >> done fi
> >
> > That -e test looks dreadful ... surely it'll u
On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II wrote:
> And I've bumped into this. How *DOES* one test for the existence of
> ANY file with a given extension without getting a "too many arguments"
> error when there are multiple files?
>
> I want "TRUE" if there is one or more
Colin Watson said:
> On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
>> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg";
>> done fi
>
> That -e test looks dreadful ... surely it'll usually expand to lots of
> arguments which will confuse [, or perhaps to an empty strin
On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg"; done fi
That -e test looks dreadful ... surely it'll usually expand to lots of
arguments which will confuse [, or perhaps to an empty string (nullglob)
which will also co
On Tue, Dec 10, 2002 at 10:11:20AM -0500, Rick Pasotto wrote:
> On Mon, Dec 09, 2002 at 11:33:03PM -0800, Osamu Aoki wrote:
> > On Mon, Dec 09, 2002 at 10:02:25PM -0600, Shyamal Prasad wrote:
> > > "drew" == drew cohan <[EMAIL PROTECTED]> writes:
> > >
> > > drew> How do I rename all files
On Mon, Dec 09, 2002 at 11:33:03PM -0800, Osamu Aoki wrote:
> On Mon, Dec 09, 2002 at 10:02:25PM -0600, Shyamal Prasad wrote:
> > "drew" == drew cohan <[EMAIL PROTECTED]> writes:
> >
> > drew> How do I rename all files in a directory matching the
> > drew> pattern *.JPG to *.jpg in a b
On Mon, Dec 09, 2002 at 11:33:03PM -0800, Osamu Aoki wrote:
> Simplest alternative without sub-shell nor special command:
>
> for i in *.JPG
> do
> mv $i ${i%\.JPG}.jpg
> done
>
> It works with any reasonable shell ash/bash/dash/... and uses only mv
> command.
I like the various clever shell
On Mon, Dec 09, 2002 at 11:33:03PM -0800, Osamu Aoki scribbled...
> On Mon, Dec 09, 2002 at 10:02:25PM -0600, Shyamal Prasad wrote:
> > "drew" == drew cohan <[EMAIL PROTECTED]> writes:
> >
> > drew> How do I rename all files in a directory matching the
> > drew> pattern *.JPG to *.jpg
On Mon, Dec 09, 2002 at 10:02:25PM -0600, Shyamal Prasad wrote:
> "drew" == drew cohan <[EMAIL PROTECTED]> writes:
>
> drew> How do I rename all files in a directory matching the
> drew> pattern *.JPG to *.jpg in a bash shell script? Thanks to
> drew> you guys I can check for the
"drew" == drew cohan <[EMAIL PROTECTED]> writes:
drew> How do I rename all files in a directory matching the
drew> pattern *.JPG to *.jpg in a bash shell script? Thanks to
drew> you guys I can check for the existence of jpgs in a
drew> directory, but can't seem get 'mv' to ren
On Mon, Dec 09, 2002 at 04:29:37PM -0500, drew cohan wrote:
> On Mon, Dec 09, 2002 at 03:03:10PM -0500, drew cohan wrote:
> > How do I rename all files in a directory matching the pattern *.JPG to
> > *.jpg in a bash shell script? Thanks to you guys I can check for the
> > existence of jpgs in a d
drew cohan wrote:
> Thanks, once again, you guys are great. One quick question about this
> one:
>
> $ rename 's/\.JPG$/.jpg/' *.JPG
>
> Shouldn't I literalize the second period like
>
> $ rename 's/\.JPG$/\.jpg/' *.JPG
>
> or doesn't that make a difference?
The replacement text is not a
also sprach drew cohan <[EMAIL PROTECTED]> [2002.12.09.2229 +0100]:
> Thanks, once again, you guys are great. One quick question about this
> one:
>
> $ rename 's/\.JPG$/.jpg/' *.JPG
>
> Shouldn't I literalize the second period like
>
> $ rename 's/\.JPG$/\.jpg/' *.JPG
>
> or doesn't that
On Mon, Dec 09, 2002 at 03:03:10PM -0500, drew cohan wrote:
> How do I rename all files in a directory matching the pattern *.JPG to
> *.jpg in a bash shell script? Thanks to you guys I can check for the
> existence of jpgs in a directory, but can't seem get 'mv' to rename
them
> for me (always co
On Mon, Dec 09, 2002 at 03:03:10PM -0500, drew cohan wrote:
> How do I rename all files in a directory matching the pattern *.JPG to
> *.jpg in a bash shell script? Thanks to you guys I can check for the
> existence of jpgs in a directory, but can't seem get 'mv' to rename them
> for me (always co
On Mon, 09 Dec 2002, drew cohan wrote:
> How do I rename all files in a directory matching the pattern
> *.JPG to *.jpg in a bash shell script? Thanks to you guys I can
> check for the existence of jpgs in a directory, but can't seem get
> 'mv' to rename them for me (always complains that the las
> drew cohan wrote:
>
> > How do I rename all files in a directory matching the pattern *.JPG to
> > *.jpg in a bash shell script? Thanks to you guys I can check for the
> > existence of jpgs in a directory, but can't seem get 'mv' to rename them
> > for me (always complains that the last argumen
On Mon, Dec 09, 2002 at 03:03:10PM -0500, drew cohan wrote:
> How do I rename all files in a directory matching the pattern *.JPG to
> *.jpg in a bash shell script? Thanks to you guys I can check for the
> existence of jpgs in a directory, but can't seem get 'mv' to rename them
> for me (always co
There are also mmv, mcp, mad, and mln. The syntax takes a little
getting used to, but once you get a feel for it, this is a nice set of
programs. I think you can apt-get mmv.
Here's an example I used yesterday. It takes a bunch of files
starting with week, then a 0 or a 1, then a single charact
drew cohan wrote:
> How do I rename all files in a directory matching the pattern *.JPG to
> *.jpg in a bash shell script? Thanks to you guys I can check for the
> existence of jpgs in a directory, but can't seem get 'mv' to rename them
> for me (always complains that the last argument must be a
35 matches
Mail list logo