Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'One-line batch file renamer' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One-line batch file renamer
Authored by: carmatana on Jan 04, '11 11:35:26PM

Hi loubregand,

Your lines have been the more helpful of all that I tried. I have one question: What if I want to make the rename (sed) just on files, excluding folders or directories at all. I have tried:

find . -type f -iname "*pattern1*" -exec echo "mv '{}' '{}'" \; | sed 's/pattern2/pattern3/2' | /bin/sh

and several more permutations but with no success

something that works is to use for pattern1 somethin like "*pattern1*.*"
and this works as long as the file has an extension, if it does not have one it is not processed

Could you or someone else can help me?

[ Reply to This | # ]