Results 1 to 7 of 7
Hello again!
I've got a jpeg folder with hundreds of pictures that I want to auto rename and number using cli if possible.
Thanks for any information!
regards,
nujinini...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-07-2011 #1
Help in Auto Rename and Numbering of Pictures (CLI)
Hello again!
I've got a jpeg folder with hundreds of pictures that I want to auto rename and number using cli if possible.
Thanks for any information!
regards,
nujinininujinini
Linux User #489667
- 08-07-2011 #2Linux User
- Join Date
- Dec 2009
- Posts
- 252
Of cause it's possible.
You can rename files with "mv"
- 08-07-2011 #3Linux User
- Join Date
- Dec 2009
- Posts
- 252
I know my answer was mean ... but since you don't tell anything from what you wanna name into what name ...
OK, here an example:
Of cause you can change:Code:#!/bin/bash filenum=0 ls -l *.jpg | while read rights no user group size date time name; do let "filenum=filenum+1" echo $name$filenum done
echo $name$filenum
into
mv $name "$date - $filenum.jpg"
- 08-09-2011 #4
Hi zombykillah!
I have this folder with these files:
This is only partial output since there are hundreds of it in that folder.Code:20840_1336045240766_1220153007_30816012_6822795_n.jpg 20840_1346402624009_1349602777_30850463_6183981_n.jpg 20840_1346402784013_1349602777_30850467_2433029_n.jpg 20845_1336850060886_1220153007_30817716_7542436_n.jpg 20846_1346481625984_1349602777_30850791_2376455_n.jpg 20846_1346481705986_1349602777_30850793_3666820_n.jpg 20846_1346481745987_1349602777_30850794_1514350_n.jpg 20847_1336259766129_1220153007_30816610_5450647_n.jpg 20847_1336265206265_1220153007_30816620_3050126_n.jpg 20861_1336058161089_1220153007_30816023_7067004_n.jpg 30475_1332638355596_1220153007_30807897_5537917_n.jpg 33391_1336831500422_1220153007_30817689_3206218_n.jpg 33419_1332637595577_1220153007_30807896_5280206_n.jpg 33432_1336834860506_1220153007_30817695_7224272_n.jpg 33437_1336835380519_1220153007_30817696_2804869_n.jpg 34037_1332649755881_1220153007_30807925_6585009_n.jpg 34065_1336236165539_1220153007_30816576_3547377_n.jpg 34065_1336862021185_1220153007_30817744_5415623_n.jpg 34066_1336045640776_1220153007_30816013_4997024_n.jpg 34099_1336820820155_1220153007_30817665_3648359_n.jpg 34116_1336274126488_1220153007_30816632_4514228_n.jpg 34119_1336060681152_1220153007_30816026_1178698_n.jpg 34148_1346377983393_1349602777_30850403_6697412_n.jpg
I wanted to rename and automatically number all these. AFAIK, if I do
$ mv /pathtofolder/folder /pathtonewfolder/newname
I can rename the folder to newname. I wanted to rename all the jpegs to say
34148_1346377983393_1349602777_30850403_6697412_n. jpg to family001
and so on.
Thank you for any advise.nujinini
Linux User #489667
- 09-04-2011 #5
I know this thread is a few weeks old.
Not a true Linux solution but does the job well.
When I used Windows my favorite image software was Irfanview.
When I moved to Linux I could not find an imaging tool that had the features of Irfanview.
Then I found that you can use Irfanview with wine.
It has a very powerful batch rename tool that allows you to select some or all images in a folder and rename it with a sequential number added to the end of the file name.
Like I said, not a true Linux alternative but until an imaging tool that is as powerful as Irfanview is made for Linux I will continue using it for those jobs that Linux imaging tools can't handle.
Wine install instructions can be found here;
WineHQ - IrfanView 4.x
- 09-13-2011 #6
TaZMAniac!
I just notice your post now. Sorry for the late replay man. Thank you for taking time to share your views. I will be giving it a try. Was not successful with the other suggestion and was kinda losing hope, figuratively speaking :Pnujinini
Linux User #489667
- 09-13-2011 #7Linux User
- Join Date
- Dec 2009
- Posts
- 252
Hi,
unfortunately I weren't notified by your answer.
Here a little script code that should work:
I've used cp so that your old files stay as they are ... he will start copy the files into the new directory.Code:#!/bin/bash filenum=0 folder="/pathtofolder/folder" newfolder="/pathtonewfolder/newname" mkdir -p $newfolder cd $folder ls -l *.jpg | while read rights no user group size date time name; do let "filenum=filenum+1" # echo $name$filenum cp $name $newfolder"/Famili"$filenum".jpg" done
Haven't testes the script but it should work.
just write it into a file, run "chmod 777 filename"
and execute it with ./filename
but first you will need to replace the $folder $newfolder strings in the script with the real ones ...


Reply With Quote
