Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #208118 > unrolled thread

Shell Script Help

Started byPatrick Bartek <patrick.bartek@gmail.com>
First post2019-05-04 17:30 +0200
Last post2019-05-06 16:20 +0200
Articles 16 — 8 participants

Back to article view | Back to linux.debian.user


Contents

  Shell Script Help Patrick Bartek <patrick.bartek@gmail.com> - 2019-05-04 17:30 +0200
    Re: Shell Script Help john doe <johndoe65534@mail.com> - 2019-05-04 20:30 +0200
      Re: Shell Script Help Patrick Bartek <nemommxiv@gmail.com> - 2019-05-06 16:10 +0200
    Re: Shell Script Help Richard Owlett <rowlett@cloud85.net> - 2019-05-04 22:40 +0200
      Re: Shell Script Help Patrick Bartek <patrick.bartek@gmail.com> - 2019-05-06 16:20 +0200
        Re: Shell Script Help Greg Wooledge <wooledg@eeg.ccf.org> - 2019-05-06 16:30 +0200
          Re: Shell Script Help john doe <johndoe65534@mail.com> - 2019-05-06 18:20 +0200
            Re: Shell Script Help Patrick Bartek <nemommxiv@gmail.com> - 2019-05-06 19:00 +0200
          Re: Shell Script Help Patrick Bartek <nemommxiv@gmail.com> - 2019-05-06 18:50 +0200
            Re: Shell Script Help Greg Wooledge <wooledg@eeg.ccf.org> - 2019-05-06 19:10 +0200
              [SOLVED] Re: Shell Script Help Patrick Bartek <nemommxiv@gmail.com> - 2019-05-06 20:00 +0200
                Re: [SOLVED] Re: Shell Script Help David Wright <deblis@lionunicorn.co.uk> - 2019-05-06 22:20 +0200
                  Re: [SOLVED] Re: Shell Script Help Patrick Bartek <nemommxiv@gmail.com> - 2019-05-07 03:30 +0200
              Re: Shell Script Help Dan Purgert <dan@djph.net> - 2019-05-06 20:10 +0200
    Re: Shell Script Help Will Mengarini <seldon@eskimo.com> - 2019-05-05 03:10 +0200
      Re: Shell Script Help Patrick Bartek <patrick.bartek@gmail.com> - 2019-05-06 16:20 +0200

#208118 — Shell Script Help

FromPatrick Bartek <patrick.bartek@gmail.com>
Date2019-05-04 17:30 +0200
SubjectShell Script Help
Message-ID<xU4LT-5qI-3@gated-at.bofh.it>
Hi! All,

Want to create a simple, one liner to type in to automate what I've
been doing manually: Perform an operation on files in unique,
sequential directories, save the results of the operations for each
directory with a file name of that directory in the directory the
target directories reside in.  For example:

Directories ab01, ab02 ... ab30 results in output

ab01.jpg. ab02.jpg ... ab30.jpg outside of those drectories.

There will never be more than 99 directories -- usually a lot less. The
actual number will vary job to job. The letters in the directory names
will vary job to job, but will remain constant for each job.  Only the
numbers will sequence. 

Any help is appreciated.

Thanks.

B

[toc] | [next] | [standalone]


#208138

Fromjohn doe <johndoe65534@mail.com>
Date2019-05-04 20:30 +0200
Message-ID<xU7A5-77C-1@gated-at.bofh.it>
In reply to#208118
On 5/4/2019 5:08 PM, Patrick Bartek wrote:
> Hi! All,
>
> Want to create a simple, one liner to type in to automate what I've
> been doing manually: Perform an operation on files in unique,
> sequential directories, save the results of the operations for each
> directory with a file name of that directory in the directory the
> target directories reside in.  For example:
>
> Directories ab01, ab02 ... ab30 results in output
>
> ab01.jpg. ab02.jpg ... ab30.jpg outside of those drectories.
>
> There will never be more than 99 directories -- usually a lot less. The
> actual number will vary job to job. The letters in the directory names
> will vary job to job, but will remain constant for each job.  Only the
> numbers will sequence.
>

Would something like the following do it:

$ mkdir -p abc; cp -v abc*.gpg abc/ | tee -a abc/abc.log

--
John Doe

[toc] | [prev] | [next] | [standalone]


#208278

FromPatrick Bartek <nemommxiv@gmail.com>
Date2019-05-06 16:10 +0200
Message-ID<xUMtA-7ge-13@gated-at.bofh.it>
In reply to#208138
On Sat, 4 May 2019 20:21:03 +0200
john doe <johndoe65534@mail.com> wrote:

> On 5/4/2019 5:08 PM, Patrick Bartek wrote:
> > Hi! All,
> >
> > Want to create a simple, one liner to type in to automate what I've
> > been doing manually: Perform an operation on files in unique,
> > sequential directories, save the results of the operations for each
> > directory with a file name of that directory in the directory the
> > target directories reside in.  For example:
> >
> > Directories ab01, ab02 ... ab30 results in output
> >
> > ab01.jpg. ab02.jpg ... ab30.jpg outside of those drectories.
> >
> > There will never be more than 99 directories -- usually a lot less. The
> > actual number will vary job to job. The letters in the directory names
> > will vary job to job, but will remain constant for each job.  Only the
> > numbers will sequence.
> >  
> 
> Would something like the following do it:
> 
> $ mkdir -p abc; cp -v abc*.gpg abc/ | tee -a abc/abc.log

Not for what I'm wanting -- See reply to Richard Ownes -- but for
something else I'm working on, yes.

Thanks

B

[toc] | [prev] | [next] | [standalone]


#208161

FromRichard Owlett <rowlett@cloud85.net>
Date2019-05-04 22:40 +0200
Message-ID<xU9BT-8jc-7@gated-at.bofh.it>
In reply to#208118
On 05/04/2019 10:08 AM, Patrick Bartek wrote:
> Hi! All,
> 
> Want to create a simple, one liner to type in to automate what I've
> been doing manually:  [*SNIP*]

I think the critical question is,> *WHAT* do you wish to accomplish?

[toc] | [prev] | [next] | [standalone]


#208280

FromPatrick Bartek <patrick.bartek@gmail.com>
Date2019-05-06 16:20 +0200
Message-ID<xUMDf-7jv-3@gated-at.bofh.it>
In reply to#208161
On Sat, 4 May 2019 15:34:16 -0500
Richard Owlett <rowlett@cloud85.net> wrote:

> On 05/04/2019 10:08 AM, Patrick Bartek wrote:
> > Hi! All,
> > 
> > Want to create a simple, one liner to type in to automate what I've
> > been doing manually:  [*SNIP*]  
> 
> I think the critical question is,> *WHAT* do you wish to accomplish?

Perhaps you're right.  I was too general in my initial query which made
it very unclear.

I want a script that allows commandline only applications that can't batch
process to batch process.  A speciifc example. I will use the app
enfuse, an exposure merging program, a poor man's HDR.

patrick@Debian9:~/Work$ enfuse --output ab01.jpg --compression=97 ab01/DSC*.jpg
patrick@Debian9:~/Work$ enfuse --output ab02.jpg --compression=97 ab02/DSC*.jpg
:
:
patrick@Debian9:~/Work$ enfuse --output ab26.jpg --compression=97 ab26/DSC*.jpg

I use shell history to repeat the command for each directory, changing the
 --output filename and target directory numbers as necessary. Each diretory already
holds the appropriate image files.

Thanks

B

[toc] | [prev] | [next] | [standalone]


#208282

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-05-06 16:30 +0200
Message-ID<xUMMV-7mO-1@gated-at.bofh.it>
In reply to#208280
On Mon, May 06, 2019 at 06:57:00AM -0700, Patrick Bartek wrote:
> I want a script that allows commandline only applications that can't batch
> process to batch process.  A speciifc example. I will use the app
> enfuse, an exposure merging program, a poor man's HDR.
> 
> patrick@Debian9:~/Work$ enfuse --output ab01.jpg --compression=97 ab01/DSC*.jpg
> patrick@Debian9:~/Work$ enfuse --output ab02.jpg --compression=97 ab02/DSC*.jpg
> :
> :
> patrick@Debian9:~/Work$ enfuse --output ab26.jpg --compression=97 ab26/DSC*.jpg
> 
> I use shell history to repeat the command for each directory, changing the
>  --output filename and target directory numbers as necessary. Each diretory already
> holds the appropriate image files.

for dir in ab*/; do
    name=${dir%/}
    enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
done

[toc] | [prev] | [next] | [standalone]


#208299

Fromjohn doe <johndoe65534@mail.com>
Date2019-05-06 18:20 +0200
Message-ID<xUOvn-8sh-5@gated-at.bofh.it>
In reply to#208282
On 5/6/2019 4:24 PM, Greg Wooledge wrote:
> On Mon, May 06, 2019 at 06:57:00AM -0700, Patrick Bartek wrote:
>> I want a script that allows commandline only applications that can't batch
>> process to batch process.  A speciifc example. I will use the app
>> enfuse, an exposure merging program, a poor man's HDR.
>>
>> patrick@Debian9:~/Work$ enfuse --output ab01.jpg --compression=97 ab01/DSC*.jpg
>> patrick@Debian9:~/Work$ enfuse --output ab02.jpg --compression=97 ab02/DSC*.jpg
>> :
>> :
>> patrick@Debian9:~/Work$ enfuse --output ab26.jpg --compression=97 ab26/DSC*.jpg
>>
>> I use shell history to repeat the command for each directory, changing the
>>  --output filename and target directory numbers as necessary. Each diretory already
>> holds the appropriate image files.
>
> for dir in ab*/; do
>     name=${dir%/}
>     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> done
>

Putting the above as a one liner:

$ for dir in ab*/; do name=${dir%/}; enfuse --output "$name.jpg"
--compression=97 "$dir"/*.jpg; done


Note that this e-mail is folded by my mailer.

--
John Doe

[toc] | [prev] | [next] | [standalone]


#208301

FromPatrick Bartek <nemommxiv@gmail.com>
Date2019-05-06 19:00 +0200
Message-ID<xUP85-dE-1@gated-at.bofh.it>
In reply to#208299
On Mon, 6 May 2019 18:12:55 +0200
john doe <johndoe65534@mail.com> wrote:

> On 5/6/2019 4:24 PM, Greg Wooledge wrote:
> > On Mon, May 06, 2019 at 06:57:00AM -0700, Patrick Bartek wrote:  
> >> I want a script that allows commandline only applications that can't batch
> >> process to batch process.  A speciifc example. I will use the app
> >> enfuse, an exposure merging program, a poor man's HDR.
> >>
> >> patrick@Debian9:~/Work$ enfuse --output ab01.jpg --compression=97 ab01/DSC*.jpg
> >> patrick@Debian9:~/Work$ enfuse --output ab02.jpg --compression=97 ab02/DSC*.jpg
> >> :
> >> :
> >> patrick@Debian9:~/Work$ enfuse --output ab26.jpg --compression=97 ab26/DSC*.jpg
> >>
> >> I use shell history to repeat the command for each directory, changing the
> >>  --output filename and target directory numbers as necessary. Each diretory already
> >> holds the appropriate image files.  
> >
> > for dir in ab*/; do
> >     name=${dir%/}
> >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > done
> >  
> 
> Putting the above as a one liner:
> 
> $ for dir in ab*/; do name=${dir%/}; enfuse --output "$name.jpg"
                                     ^
> --compression=97 "$dir"/*.jpg; done
                               ^
I added those semi-colons just as you did to make it one liner correct:
Same error.

Time to troubleshoot. I hope it's just a syntax error somewhere.

Thanks for your reply.

B

[toc] | [prev] | [next] | [standalone]


#208300

FromPatrick Bartek <nemommxiv@gmail.com>
Date2019-05-06 18:50 +0200
Message-ID<xUOYq-am-3@gated-at.bofh.it>
In reply to#208282
On Mon, 6 May 2019 10:24:24 -0400
Greg Wooledge <wooledg@eeg.ccf.org> wrote:

> On Mon, May 06, 2019 at 06:57:00AM -0700, Patrick Bartek wrote:
> > I want a script that allows commandline only applications that can't batch
> > process to batch process.  A speciifc example. I will use the app
> > enfuse, an exposure merging program, a poor man's HDR.
> > 
> > patrick@Debian9:~/Work$ enfuse --output ab01.jpg --compression=97 ab01/DSC*.jpg
> > patrick@Debian9:~/Work$ enfuse --output ab02.jpg --compression=97 ab02/DSC*.jpg
> > :
> > :
> > patrick@Debian9:~/Work$ enfuse --output ab26.jpg --compression=97 ab26/DSC*.jpg
> > 
> > I use shell history to repeat the command for each directory, changing the
> >  --output filename and target directory numbers as necessary. Each diretory already
> > holds the appropriate image files.  
> 
> for dir in ab*/; do
>     name=${dir%/}
>     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> done
> 

Typed in as a single line with a semi-colon at end of enfuse command
and before done to keep it from locking up, generates error "enfuse:
failed to open "ab*//*.jpg: No such file or directory. But it's a
beginning. Time to pull out my 400 page Unix shell programming book.

Thanks.

B

[toc] | [prev] | [next] | [standalone]


#208302

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-05-06 19:10 +0200
Message-ID<xUPhM-wy-3@gated-at.bofh.it>
In reply to#208300
On Mon, May 06, 2019 at 09:41:58AM -0700, Patrick Bartek wrote:
> On Mon, 6 May 2019 10:24:24 -0400
> Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> > for dir in ab*/; do
> >     name=${dir%/}
> >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > done
> 
> Typed in as a single line with a semi-colon at end of enfuse command
> and before done to keep it from locking up, generates error "enfuse:
> failed to open "ab*//*.jpg: No such file or directory. But it's a
> beginning. Time to pull out my 400 page Unix shell programming book.

Most likely it means there weren't any matching directories wherever
you ran it.  The ab*/ glob will be used literally if it doesn't match
any directories.

If you want to check for that, you can add a test.

for dir in ab*/; do
    test -d "$dir" || continue
    name=${dir%/}
    enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
done

You said you had twenty-something directories named ab01, ab02, etc.
So it should have matched unless you ran it from the wrong place,
or unless you lied about your directory names.

But nobody would EVER lie about their directory names in a shell
programming question.  Oh, no, never.

[toc] | [prev] | [next] | [standalone]


#208307 — [SOLVED] Re: Shell Script Help

FromPatrick Bartek <nemommxiv@gmail.com>
Date2019-05-06 20:00 +0200
Subject[SOLVED] Re: Shell Script Help
Message-ID<xUQ4a-Ud-5@gated-at.bofh.it>
In reply to#208302
On Mon, 6 May 2019 13:08:05 -0400
Greg Wooledge <wooledg@eeg.ccf.org> wrote:

> On Mon, May 06, 2019 at 09:41:58AM -0700, Patrick Bartek wrote:
> > On Mon, 6 May 2019 10:24:24 -0400
> > Greg Wooledge <wooledg@eeg.ccf.org> wrote:  
> > > for dir in ab*/; do
> > >     name=${dir%/}
> > >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > > done  
> > 
> > Typed in as a single line with a semi-colon at end of enfuse command
> > and before done to keep it from locking up, generates error "enfuse:
> > failed to open "ab*//*.jpg: No such file or directory. But it's a
> > beginning. Time to pull out my 400 page Unix shell programming book.  
> 
> Most likely it means there weren't any matching directories wherever
> you ran it.  The ab*/ glob will be used literally if it doesn't match
> any directories.
> 
> If you want to check for that, you can add a test.
> 
> for dir in ab*/; do
>     test -d "$dir" || continue
>     name=${dir%/}
>     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> done
> 
> You said you had twenty-something directories named ab01, ab02, etc.
> So it should have matched unless you ran it from the wrong place,
> or unless you lied about your directory names.
> 
> But nobody would EVER lie about their directory names in a shell
> programming question.  Oh, no, never.

Silly me.  I failed to substitute the correct dir name letters in the
script for example "ab" prefix I origninaly posted. Didn"t even notice
until I started troubleshooting 3 hours later. That's what I get for
reading the list a 6:00am. With semi-colons properly placed for a one
liner, it works.

Thanks.

B

[toc] | [prev] | [next] | [standalone]


#208321 — Re: [SOLVED] Re: Shell Script Help

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2019-05-06 22:20 +0200
SubjectRe: [SOLVED] Re: Shell Script Help
Message-ID<xUSfD-2qH-1@gated-at.bofh.it>
In reply to#208307
On Mon 06 May 2019 at 10:56:47 (-0700), Patrick Bartek wrote:
> On Mon, 6 May 2019 13:08:05 -0400 Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> > On Mon, May 06, 2019 at 09:41:58AM -0700, Patrick Bartek wrote:
> > > On Mon, 6 May 2019 10:24:24 -0400 Greg Wooledge <wooledg@eeg.ccf.org> wrote:  
> > > > for dir in ab*/; do
> > > >     name=${dir%/}
> > > >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > > > done  
> > > 
> > > Typed in as a single line with a semi-colon at end of enfuse command
> > > and before done to keep it from locking up, generates error "enfuse:
> > > failed to open "ab*//*.jpg: No such file or directory. But it's a
> > > beginning. Time to pull out my 400 page Unix shell programming book.  
> > 
> > Most likely it means there weren't any matching directories wherever
> > you ran it.  The ab*/ glob will be used literally if it doesn't match
> > any directories.
> > 
> > If you want to check for that, you can add a test.
> > 
> > for dir in ab*/; do
> >     test -d "$dir" || continue
> >     name=${dir%/}
> >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > done
> > 
> > You said you had twenty-something directories named ab01, ab02, etc.
> > So it should have matched unless you ran it from the wrong place,
> > or unless you lied about your directory names.
> > 
> > But nobody would EVER lie about their directory names in a shell
> > programming question.  Oh, no, never.
> 
> Silly me.  I failed to substitute the correct dir name letters in the
> script for example "ab" prefix I origninaly posted. Didn"t even notice
> until I started troubleshooting 3 hours later. That's what I get for
> reading the list a 6:00am. With semi-colons properly placed for a one
> liner, it works.

You don't really need to place semicolons anywhere for a one-liner;
the system does it for you. I've cut and pasted Greg's example into
the command line, and then pressed Uparrow (for history recall):

$ for dir in ab*/; do
>     name=${dir%/}
>     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> done
bash: enfuse: command not found
$ for dir in ab*/; do     name=${dir%/};     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg; done

and there's your one-liner.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#208333 — Re: [SOLVED] Re: Shell Script Help

FromPatrick Bartek <nemommxiv@gmail.com>
Date2019-05-07 03:30 +0200
SubjectRe: [SOLVED] Re: Shell Script Help
Message-ID<xUX5D-5lk-1@gated-at.bofh.it>
In reply to#208321
On Mon, 6 May 2019 15:16:09 -0500
David Wright <deblis@lionunicorn.co.uk> wrote:

> On Mon 06 May 2019 at 10:56:47 (-0700), Patrick Bartek wrote:
> > On Mon, 6 May 2019 13:08:05 -0400 Greg Wooledge <wooledg@eeg.ccf.org> wrote:  
> > > On Mon, May 06, 2019 at 09:41:58AM -0700, Patrick Bartek wrote:  
> > > > On Mon, 6 May 2019 10:24:24 -0400 Greg Wooledge <wooledg@eeg.ccf.org> wrote:    
> > > > > for dir in ab*/; do
> > > > >     name=${dir%/}
> > > > >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > > > > done    
> > > > 
> > > > Typed in as a single line with a semi-colon at end of enfuse command
> > > > and before done to keep it from locking up, generates error "enfuse:
> > > > failed to open "ab*//*.jpg: No such file or directory. But it's a
> > > > beginning. Time to pull out my 400 page Unix shell programming book.    
> > > 
> > > Most likely it means there weren't any matching directories wherever
> > > you ran it.  The ab*/ glob will be used literally if it doesn't match
> > > any directories.
> > > 
> > > If you want to check for that, you can add a test.
> > > 
> > > for dir in ab*/; do
> > >     test -d "$dir" || continue
> > >     name=${dir%/}
> > >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > > done
> > > 
> > > You said you had twenty-something directories named ab01, ab02, etc.
> > > So it should have matched unless you ran it from the wrong place,
> > > or unless you lied about your directory names.
> > > 
> > > But nobody would EVER lie about their directory names in a shell
> > > programming question.  Oh, no, never.  
> > 
> > Silly me.  I failed to substitute the correct dir name letters in the
> > script for example "ab" prefix I origninaly posted. Didn"t even notice
> > until I started troubleshooting 3 hours later. That's what I get for
> > reading the list a 6:00am. With semi-colons properly placed for a one
> > liner, it works.  
> 
> You don't really need to place semicolons anywhere for a one-liner;
> the system does it for you. I've cut and pasted Greg's example into
> the command line, and then pressed Uparrow (for history recall):
> 
> $ for dir in ab*/; do
> >     name=${dir%/}
> >     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg
> > done  
> bash: enfuse: command not found
> $ for dir in ab*/; do     name=${dir%/};     enfuse --output "$name.jpg" --compression=97 "$dir"/*.jpg; done
> 
> and there's your one-liner.

I come from a time when "The System" did nothing for you.  If you
missed a period or semi-colon, etc. execution stopped and, if you were
lucky, you got a cryptic error code number with no other explanation.
Hell, my Unix shell programming book is almost 30 years old! And it's
one of the newer ones. ;-)

But thanks for the info anyway.

B

[toc] | [prev] | [next] | [standalone]


#208310

FromDan Purgert <dan@djph.net>
Date2019-05-06 20:10 +0200
Message-ID<xUQdS-1dq-27@gated-at.bofh.it>
In reply to#208302
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Greg Wooledge wrote:
> [...]
> You said you had twenty-something directories named ab01, ab02, etc.
> So it should have matched unless you ran it from the wrong place,
> or unless you lied about your directory names.
>
> But nobody would EVER lie about their directory names in a shell
> programming question.  Oh, no, never.

- From the book of bashisms, verse 10:

  All examples given by the questioner will be broken, misleading,
  wrong, incomplete, and/or not representative of the actual question.

Thus sayeth the leaden feline. :)  

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAlzQdLwACgkQjhHd8xJ5
ooHkrQgAnM5ONF1FsghmSKoeisYMukEN/Aq2bJlOjYWCo2F++uZm8/paMpv6UE4J
TDmilhYwKiyZVgvewSezeKv2CSkOU2gvwfEioKaX7riKY97Vd4cRysJPy5Pk6Yaj
Iv+apfmpGb+FaZt3Bw2jeZYqEBeZaGvhAC/YKnLexsrcBmsLtwrTWd+EpivKLtUu
8dXH3XPTjvI9S7ZT2Cf8lzlXsQ58LV6K0zTeSTuDjAoFenkxthSReMTHaz4tppDk
F58h+XOatqqUDceBfDh4aM48kHb9mHP9KpN56JWpSjCiDfuEx86EnkQHWlzwR4cM
c+n0iFbFh21NFxfU/nQig/uZfT5EsA==
=LRX7
-----END PGP SIGNATURE-----

-- 
|_|O|_| 
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5  4AEE 8E11 DDF3 1279 A281

[toc] | [prev] | [next] | [standalone]


#208169

FromWill Mengarini <seldon@eskimo.com>
Date2019-05-05 03:10 +0200
Message-ID<xUdPb-2vo-1@gated-at.bofh.it>
In reply to#208118
* Patrick Bartek <patrick.bartek@gmail.com> [19-05/04=Sa 08:08 -0700]:
> [...] Perform an operation on files in unique, sequential
> directories [...] never more than 99 -- usually a lot
> less.  The actual number will vary job to job.  [...]

If the sequentially-numbered directories already exist:
  `man find`
Else:
  for ((i=1;i<12;++i));{ printf frob%02d\\n $i;} # tested: Bash 3 & 4

* Patrick Bartek <patrick.bartek@gmail.com> [19-05/04=Sa 08:08 -0700]:
> Want to create a simple, one liner to type in to automate what I've
> been doing manually: Perform an operation on files in unique,
> sequential directories, save the results of the operations for each
> directory with a file name of that directory in the directory the
> target directories reside in.  For example:
> 
> Directories ab01, ab02 ... ab30 results in output
> 
> ab01.jpg. ab02.jpg ... ab30.jpg outside of those drectories.
> 
> There will never be more than 99 directories -- usually a lot less. The
> actual number will vary job to job. The letters in the directory names
> will vary job to job, but will remain constant for each job.  Only the
> numbers will sequence. 

[toc] | [prev] | [next] | [standalone]


#208281

FromPatrick Bartek <patrick.bartek@gmail.com>
Date2019-05-06 16:20 +0200
Message-ID<xUMDf-7jv-7@gated-at.bofh.it>
In reply to#208169
On Sat, 4 May 2019 17:54:28 -0700
Will Mengarini <seldon@eskimo.com> wrote:

> * Patrick Bartek <patrick.bartek@gmail.com> [19-05/04=Sa 08:08 -0700]:
> > [...] Perform an operation on files in unique, sequential
> > directories [...] never more than 99 -- usually a lot
> > less.  The actual number will vary job to job.  [...]  
> 
> If the sequentially-numbered directories already exist:
>   `man find`
> Else:
>   for ((i=1;i<12;++i));{ printf frob%02d\\n $i;} # tested: Bash 3 & 4
> 
> [snip]

Thanks.  That helpts.

B

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web