[Novalug] Linux Batch File Renaming
Wei Wu Wei
wei.wu.wei.1 at gmail.com
Wed Nov 25 14:11:33 EST 2009
On Mon, Nov 23, 2009 at 10:39 PM, Nino Pereira <pereira at speakeasy.net> wrote:
>> over the years I have seen various ways to change file names
>> in a directory, e.g., from lower case to upper case or vice
>> versa, in some automatic way. Unfortunately, I can't remember
>> which program to use with this: awk? , sed? the mind boggles.
>> I have a long list of files without extensions. I want to
>> add an extension (like .pdf or .jpg or .gif). How do you do that?
>> Thank you.
It's really as simple as this [without the brackets]
[for i in * ; do `mv $i $i.ext`; done] where ".ext" is your desired
extension, and where this command is run from the directory where you
want the files modified.
You could also play it safe and use "cp" instead of "mv" to make a
copy of the file with a new extension rather than moving the original
"That which does not kill us, only makes us stronger."
"Every truth passes through three stages before it is recognized: In
the first it is ridiculed, in the second it is opposed, in the third
it is regarded as self-evident" --Arthur Schopenhauer (German
"An avidity to punish is always dangerous to liberty. It leads men to
stretch, to misinterpret and to misapply even the best of laws. He
that would make his own liberty secure, must guard even his enemy from
oppression; for if he violates this duty, he establishes a precedent
that will reach himself." --Thomas Paine , 1795
This e-mail (and any attachments) contains PRIVILEGED AND CONFIDENTIAL
information intended for the use of the named addressee(s). If you
are not the intended recipient: (a) any use, dissemination or copying
of this transmission is strictly prohibited, (b) delete this
transmission and (c) notify the sender.
More information about the Novalug