Batch File Rename(JPEG) macro?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Batch File Rename(JPEG) macro?

Zachary Sager
Does anyone know of a quick macro that will rename all files(just jpegs) in
a folder, in a sequence?  The only condition is I want to specify the name
of the first file in the list.  That name will always be a number(for
example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
until everything has been renamed.

My code writing ability is pretty poor, and now I'm just trying to cut and
paste from other sources, but I can't find anything too similar.

Thanks!
-zack
Reply | Threaded
Open this post in threaded view
|

Re: Batch File Rename(JPEG) macro?

Fabrice Senger
Zachary Sager a écrit :

> Does anyone know of a quick macro that will rename all files(just jpegs) in
> a folder, in a sequence?  The only condition is I want to specify the name
> of the first file in the list.  That name will always be a number(for
> example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
> until everything has been renamed.
>
> My code writing ability is pretty poor, and now I'm just trying to cut and
> paste from other sources, but I can't find anything too similar.
>
> Thanks!
> -zack
>  
It exists in the recent versions of imageJ but I never tried it, one
usefull program could be "TheRename"...

Fabrice.

--
Senger Fabrice
Reply | Threaded
Open this post in threaded view
|

Re: Batch File Rename(JPEG) macro?

Justin Walker-3
In reply to this post by Zachary Sager
If you are running in Windows, The batch file renamer
(http://cerebralsynergy.com/download.php?view.55) will likely do what
you want.  It's freeware and relatively easy to use.

- Justin Walker

Zachary Sager wrote:

> Does anyone know of a quick macro that will rename all files(just jpegs) in
> a folder, in a sequence?  The only condition is I want to specify the name
> of the first file in the list.  That name will always be a number(for
> example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
> until everything has been renamed.
>
> My code writing ability is pretty poor, and now I'm just trying to cut and
> paste from other sources, but I can't find anything too similar.
>
> Thanks!
> -zack
>  
Reply | Threaded
Open this post in threaded view
|

Re: Batch File Rename(JPEG) macro?

Miguel A. de Pedro
In reply to this post by Zachary Sager
Hi Zack,

This is probably not exactly what you want, but you can do something very
close in Windows (if you are PC) with the file>rename command. Select all
files in the folder, leaving the cursor in the file you want to be the
first,click right  mouse button, select rename and enter the common
characters you want for all the files, then click enter and you end up
with a series of files with the common name (or number) name and a serial
numeral in parenthesis.

All the best

Miguel

Does anyone know of a quick macro that will rename all files(just jpegs)

> in
> a folder, in a sequence?  The only condition is I want to specify the name
> of the first file in the list.  That name will always be a number(for
> example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
> until everything has been renamed.
>
> My code writing ability is pretty poor, and now I'm just trying to cut and
> paste from other sources, but I can't find anything too similar.
>
> Thanks!
> -zack
>
Reply | Threaded
Open this post in threaded view
|

Re: Batch File Rename(JPEG) macro?

F Javier Díez Guerra
In reply to this post by Zachary Sager
Zack,

I find the freeware Irfanview (http://www.irfanview.com) very useful for
such purposes. In version 3.97 you can call a "Batch conversion/Rename"
function from the "File" menu.

Good luck.


F Javier Díez Guerra, PhD
Profesor Titular
Centro de Biología Molecular Severo Ochoa
C/ Nicolás Cabrera, 1
Universidad Autónoma
Ctra Colmenar Viejo Km 15
Cantoblanco, 28049 Madrid
SPAIN

phone:  +34 91 196 4612
e-mail: [hidden email]



-----Mensaje original-----
De: ImageJ Interest Group [mailto:[hidden email]] En nombre de Zachary
Sager
Enviado el: 09 December 2008 16:31
Para: [hidden email]
Asunto: Batch File Rename(JPEG) macro?

Does anyone know of a quick macro that will rename all files(just jpegs) in
a folder, in a sequence?  The only condition is I want to specify the name
of the first file in the list.  That name will always be a number(for
example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
until everything has been renamed.

My code writing ability is pretty poor, and now I'm just trying to cut and
paste from other sources, but I can't find anything too similar.

Thanks!
-zack
Reply | Threaded
Open this post in threaded view
|

Re: Batch File Rename(JPEG) macro?

jmutterer
In reply to this post by Miguel A. de Pedro
Zack,
the following macro does what you explained.

// batch rename jpgs
dir = getDirectory('Choose Directory ');
list = getFileList(dir);
n=1000;
for (i=0; i<list.length; i++) {
    if (endsWith(toLowerCase(list[i]),".jpg")) {
    newpath = dir+n+".jpg";
    if (!File.exists(newpath)) { done = File.rename(dir+list[i],newpath); }
    else { print("error: "+newpath); }
    n++;
    }
}
// end

Jerome.


On Tue, Dec 9, 2008 at 6:03 PM, Miguel A. de Pedro <[hidden email]>wrote:

> Hi Zack,
>
> This is probably not exactly what you want, but you can do something very
> close in Windows (if you are PC) with the file>rename command. Select all
> files in the folder, leaving the cursor in the file you want to be the
> first,click right  mouse button, select rename and enter the common
> characters you want for all the files, then click enter and you end up
> with a series of files with the common name (or number) name and a serial
> numeral in parenthesis.
>
> All the best
>
> Miguel
>
> Does anyone know of a quick macro that will rename all files(just jpegs)
> > in
> > a folder, in a sequence?  The only condition is I want to specify the
> name
> > of the first file in the list.  That name will always be a number(for
> > example, 1000.jpg)  Then I want them to be named 1001.jpg, 1002.jpg, etc.
> > until everything has been renamed.
> >
> > My code writing ability is pretty poor, and now I'm just trying to cut
> and
> > paste from other sources, but I can't find anything too similar.
> >
> > Thanks!
> > -zack
> >
>