On 08/05/2011 03:45 PM, Dazed_75 wrote: > 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 " 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. > -- > Dazed_75 a.k.a. Larry > > The spirit of resistance to government is so valuable on certain > occasions, that I wish it always to be kept alive. > - Thomas Jefferson > > > --------------------------------------------------- > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > To subscribe, unsubscribe, or to change your mail settings: > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss if there are no spaces in your filenames, you can do something like: >for i in `ls Screenshot-PXEmenu-*.png`; do mv "${i}" "${i/Screenshot-/}"; done where the ${var/pattern/replacement} replaces part of the variable (see http://tldp.org/LDP/abs/html/parameter-substitution.html) If there are spaces in the name, than the for loop will loop over each word in each filename, which will break it, so you can use the following trick to get around that: >find . -maxdepth 1 -iname "Screenshot-PXEmenu-*.png" -print0 | while read -d $'\0' i; do echo "${i/Screenshot-/}"; done Drop the maxdepth if you want it to be recursive. B