batch job

Dale Farnsworth dale at farnsworth.org
Fri Aug 5 15:58:08 MST 2011


> 
> I have finished doing the work but did it manually.  For future reference,
> I'd like to re-learn what I forgot from 20+ years ago about how to do this
> the easy way.  Basically, I had a directory full of files that I wanted to
> process all the same way and rename them in the process.  What I could not
> remember was how with globbing, I could specify the output name part that
> was wild-carded in the input should be used in the output.
> 
> Lets say I have a bunch of files named Screenshot-PXEmenu-*.png and I want
> to copy or rename them to PXEmenu-*.png.  Both mv and copy fail
> (understandably?) using "<command> Screenshot-PXEmenu-*.png PXEmenu-*.png".
> I am pretty sure there is a way to make one or both work with a syntax for
> the target I do not remember.  Any clues?
> 
> The names are real, though what I was really doing was using the convert
> command of ImageMagick to negate all the colors in those screenshots so I
> had a specified input and output file anyway.  NTL, the base question here
> is the real one.

IMO, the easiest way is with the rename command.

	rename 's/Screenshot-PXEmenu/PXEmenu/' Screenshot-PXEmenu-*.png

-Dale


More information about the PLUG-discuss mailing list