On Thu, Mar 1, 2012 at 8:13 PM, pete <p.nikolic1@btinternet.com> wrote:
> I have some 350 picture files *with names *along the lines of
> "IMG_7127 EOS-1D Mark III copy.jpg" * *i would like to rename them all
> to more like "IMG_7127.jpg" *i have tried a few times tonight and cant
> get my head around it anyone got a script that can do it
I like using vim for those tasks because of the interactivity (I fear
my dirty little scripts will go rogue and ruin all my files...)
Here's how it works:
$ ls | vim -
Then I get in vim one line per filename (unless there's a file with a
in its name, wich there never will be on my system!)
I use some vim commands to get something like (usualy something with
:%s/foo/bar)
...
mv "IMG_7127 EOS-1D Mark III copy.jpg" "IMG_7127.jpg"
mv "IMG_7128 EOS-1D Mark III copy.jpg" "IMG_7128.jpg"
...
Then I triple check if everything is OK (did I mention I'm paranoid?)
And finaly
:w !sh
To make vim execute the whole file as a sh script.
Done.
03-02-2012, 12:25 AM
Matthew Monaco
renaming files
On 03/01/2012 04:13 PM, pete wrote:
> Hi folks
>
> Bit sort of off topic but hopefully ok
>
> I have some 350 picture files with names along the lines of
> "IMG_7127 EOS-1D Mark III copy.jpg" i would like to rename them all
> to more like "IMG_7127.jpg" i have tried a few times tonight and cant
> get my head around it anyone got a script that can do it
>
> Thanks Pete .
>
>
I just picked vim-renamer in the AUR because I got tired of the limitations of
"rename."
It opens up a browse-able buffer (like when you open a directory with vim). It's
got a pretty clean interface and I haven't had any problems with it so far.
03-02-2012, 01:58 AM
Jarek Sedlacek
renaming files
You can use the same strategy to get rid of that space:
rename " " "" *.jpg
Thanks,
Jarek Sedlacek
On Thu, Mar 1, 2012 at 6:25 PM, pete <p.nikolic1@btinternet.com> wrote:
> On Thu, 1 Mar 2012 18:15:56 -0500
> Jarek Sedlacek <JarekSedlacek@gmail.com> wrote:
>
> > rename "EOS-1D Mark III copy" "" *.jpg
>
> That almost did it now got a space "IMG_7059 .jpg" before the
> extension on each file
>
> Must admit thanks folks talk about lightening response brilliant
>
> Pete .
>
>
> --
> Linux 7-of-9 3.2.8-1-ARCH #1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012
> x86_64 AMD Phenom(tm) 9600B Quad-Core Processor AuthenticAMD GNU/Linux
>
03-02-2012, 03:03 AM
XeCycle
renaming files
pete <p.nikolic1@btinternet.com> writes:
> Hi folks
>
> Bit sort of off topic but hopefully ok
>
> I have some 350 picture files with names along the lines of
> "IMG_7127 EOS-1D Mark III copy.jpg" i would like to rename them all
> to more like "IMG_7127.jpg" i have tried a few times tonight and cant
> get my head around it anyone got a script that can do it
Install `moreutils' from [community], and use `vidir'.
Otherwise, if you use Emacs, then C-x C-q in dired does that in
the Emacs way.
--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
03-02-2012, 05:58 AM
gt
renaming files
On Thu, Mar 01, 2012 at 11:13:03PM +0000, pete wrote:
> Hi folks
>
> Bit sort of off topic but hopefully ok
>
> I have some 350 picture files with names along the lines of
> "IMG_7127 EOS-1D Mark III copy.jpg" i would like to rename them all
> to more like "IMG_7127.jpg" i have tried a few times tonight and cant
> get my head around it anyone got a script that can do it
If you don't mind graphical tools, try metamorphose2, it's available in
the aur, and is an extremely powerful renamer, and quite easy to use
too.
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
On Thu, Mar 01, 2012 at 11:13:03PM +0000, pete wrote:
Hi folks
Bit sort of off topic but hopefully ok
I have some 350 picture files with names along the lines of
"IMG_7127 EOS-1D Mark III copy.jpg" i would like to rename them all
to more like "IMG_7127.jpg" i have tried a few times tonight and cant
get my head around it anyone got a script that can do it
If you don't mind graphical tools, try metamorphose2, it's available in
the aur, and is an extremely powerful renamer, and quite easy to use
too.
On Thu, Mar 01, 2012 at 11:13:03PM +0000, pete wrote:
Hi folks
Bit sort of off topic but hopefully ok
I have some 350 picture files with names along the lines of
"IMG_7127 EOS-1D Mark III copy.jpg" i would like to rename them all
to more like "IMG_7127.jpg" i have tried a few times tonight and cant
get my head around it anyone got a script that can do it
If you don't mind graphical tools, try metamorphose2, it's available in
the aur, and is an extremely powerful renamer, and quite easy to use
too.
And there's GPRename, too.
I've used batren in the past with great results. I couldn't find it in
AUR so I've uploaded a PKGBUILD to it.
Il 02 marzo 2012 00:13, pete <p.nikolic1@btinternet.com> ha scritto:
> I have some 350 picture files *with names *along the lines of
> "IMG_7127 EOS-1D Mark III copy.jpg" * *i would like to rename them all
> to more like "IMG_7127.jpg" *i have tried a few times tonight and cant
> get my head around it anyone got a script that can do it
There have been lots of good suggestion. I put on the plate "detox":
https://aur.archlinux.org/packages.php?ID=7130
Its purpose is eliminating from filenames charachters that make them
difficult to work with, so it's also good for files *beginning* with a
space, esoteric utf8 characters, escape codes, parentheses and
whatever. It's kind of overkill for this, but it deserves to be
mentioned :-)