<div dir="ltr">Why not write a simple for loop in bash?<div>for $FILE in *</div><div>do</div><div>mv $FILE $FILE.whatever</div><div>done</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 26, 2019 at 4:23 AM Ronald Barnes <<a href="mailto:ron@ronaldbarnes.ca">ron@ronaldbarnes.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi everyone,<br>
<br>
As you probably already know, Gnu/Linux distributions do not come with a <br>
rename utility similar to what some of us "grew up on" in DOS and/or OS/2.<br>
<br>
The "mv" (move) command is to be used instead. But it doesn't handle <br>
things like "mv *.htm *.html".<br>
<br>
So, I decided to tackle writing one.<br>
<br>
<br>
Since bash has "Pathname Expansion", which expands a parameter like <br>
"*.htm" into a list of files that match that expression, it was a bit <br>
more challenging than I expected.<br>
<br>
<br>
However, I think I have something that handles wildcards sufficiently well.<br>
<br>
> <a href="https://github.com/RonaldBarnes/bash-rename" rel="noreferrer" target="_blank">https://github.com/RonaldBarnes/bash-rename</a><br>
<br>
<br>
If anyone is interested in having a look, and providing feedback, it <br>
would be welcome.<br>
<br>
<br>
There is a "rename.sh" which does the parameter parsing (although once <br>
it parses the parameters, "mv" does the actual work), and a <br>
"<a href="http://rename.unit-tests.sh" rel="noreferrer" target="_blank">rename.unit-tests.sh</a>" which is - so far - just notes to myself on edge <br>
cases.<br>
<br>
<br>
<br>
I'm pretty sure this utility can be of some use to a significant number <br>
of people and hopefully someone on this list will agree.<br>
<br>
<br>
Note, there's a "no-op" aka "dry-run" option of -n that will prevent any <br>
files from being touched / moved / renamed, and a -vvv option to spew <br>
out debugging info to help determine how the script derives the target <br>
file name from the wildcards provided.<br>
<br>
<br>
<br>
Thanks!<br>
<br>
rb<br>
<br>
_______________________________________________<br>
kwlug-disc mailing list<br>
<a href="mailto:kwlug-disc@kwlug.org" target="_blank">kwlug-disc@kwlug.org</a><br>
<a href="http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org" rel="noreferrer" target="_blank">http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org</a><br>
</blockquote></div>