Page 1 of 1

how to rename the images with names in my excelsheet?

PostPosted: Sat Nov 23, 2013 7:31 pm
by harsha
I have a product images in bulk and i need to rename those pictures with product names, how can i do that please reply me as early as possible

my sheet is like this
image no name
0001 brush
0002 cleaning oil
0003 television

BRU/BRC dont support .csv/.xls/etc, Must convert

PostPosted: Tue Nov 26, 2013 5:37 am
by truth
BRC doesnt support renaming from a file, you can either:
Use BRU, after converting the excel-data into a RenamePairs-file OR
Use BRC, after converting the excel-data into a batch.

In either case, you still need to know .extensions, Dirs, etc.

Re: how to rename the images with names in my excelsheet?

PostPosted: Thu Feb 20, 2014 1:04 am
by dustinsaunders
You could rename off a CSV file with a regular .vbs file. Something like this, I use it to rename folders off a CSV and could be modified to do what you need:

Code: Select all
'DIM ObjFSO, objCSV

Const ForReading = 1
Const ForAppending = 8

set objFSO = CreateObject("Scripting.FileSystemObject")
set objCSV = ObjFSO.OpenTextFile("listname.csv", ForReading , true )
set objLOG = ObjFSO.OpenTextFile("error.txt", ForAppending, true )

Do until objCSV.AtEndOfStream
   strLine = ObjCSV.Readline
   StrOldFolder = "C:\pathtofile\" & Left(strLine, Instr(strLine, ",") -1 )
   SrtNewFolder = mid(strLine, Instr(strLine, ",") + 1)
   'Wscript.echo "source" & StrOldFolder
   'Wscript.echo "destin" & SrtNewFolder
   If objFSO.FolderExists (StrOldFolder) then
        ObjFSO.MoveFolder StrOldFolder , SrtNewFolder
   else
        Objlog.WriteLine (StrOldFolder)
   end if
   
Loop
ObjCSV.Close

Rename from .csv

PostPosted: Sun Mar 09, 2014 7:23 am
by truth
Another solution:
FOR /f "delims=, tokens=1,2" %F in (renames.txt) do @REN "%F".* "%G".*

It assumes ALL of the following:
Renames.txt is in .csv format & no commas exist within filenames
All files are in the same directory, & all filetypes should be renamed
Renames.txt specifies EntireFilenames (minus .ext)

If anything isnt true, modify as needed or post back with details.
The BRC equivalent is below, in case you need to incorporate more options:
FOR /f "delims=, tokens=1,2" %F in (renames.txt) do @brc32 /pattern:"%F".* /fixedname:"%G" /execute