Batch renaming photos according to fields

  • Thread starter Thread starter Mike B
  • Start date Start date
M

Mike B

I have a database for a store that contains all my inventory information.
These items also have a picture assigned to them. Right now the pictures are
named according to their inventory number in the "Product Number" field. What
I need to do is rename them according to the, for example, "UPC Code" field.

I know that there is a way to do this because someone showed me but it was a
while ago and I cannot remember how they did it. The end result was they
created the code in Access (I think they used the query mode) then saved it
in a text file which they renamed as a .bat file so when you open it, the
command line opens and begins renaming the files. If any one could help, I
would greatly appreciate it. Thank you.
 
Mike said:
I have a database for a store that contains all my inventory information.
These items also have a picture assigned to them. Right now the pictures are
named according to their inventory number in the "Product Number" field. What
I need to do is rename them according to the, for example, "UPC Code" field.

I know that there is a way to do this because someone showed me but it was a
while ago and I cannot remember how they did it. The end result was they
created the code in Access (I think they used the query mode) then saved it
in a text file which they renamed as a .bat file so when you open it, the
command line opens and begins renaming the files. If any one could help, I
would greatly appreciate it. Thank you.

I'm assuming it's easy enough to create a query which selects
Product-Number and UPC-Code - right?

In the query builder (or SQL if you prefer) modify the term:
[Product-Number]
....to become:
OLD: "REN "& [Product-Number] & ".jpg "

Then, when you run that, you should see in the output a column headed
"OLD" with lines like this:

REN 123456.jpg
.... followed by the relevant UPC Code.

Then do the same for the second term, so:
[UPC-Code]
... becomes:
NEW:[UPC-Code] & ".jpg"

When you run it now, you should see two columns again, but now the
second one is headed "NEW" and each line should contain something like:
REN 123456.jpg UPC-abcdef.jpg

Publish it to Excel, and save it as a tab-separated file, and then
change the extension to .cmd.

Vital-step: make a copy of the whole folder first!

Then run the script you just created (edit out the header line first).

Caveat, it's late in the evening and this is an untested
"thought-experiment" so watch out!

Phil, London
 
Sorry for the delay. My first post was kind of vague on some details. I'm not
all that familiar with Access so let me start over. The database that I am
using has a table called ITEMFILE. The pictures are named according to the
field "GROUP" and I need to rename them to match the corresponding field "SKU"

The pictures are stored on another drive (e:) and the database file is on
c: (I can move both to the same location if need be). Also, would there be an
easier way to do this? Excel for example? I don't have to use Access, it is
just how I saw it done. Thanks for your patience!

Mike

Philip Herlihy said:
Mike said:
I have a database for a store that contains all my inventory information.
These items also have a picture assigned to them. Right now the pictures are
named according to their inventory number in the "Product Number" field. What
I need to do is rename them according to the, for example, "UPC Code" field.

I know that there is a way to do this because someone showed me but it was a
while ago and I cannot remember how they did it. The end result was they
created the code in Access (I think they used the query mode) then saved it
in a text file which they renamed as a .bat file so when you open it, the
command line opens and begins renaming the files. If any one could help, I
would greatly appreciate it. Thank you.

I'm assuming it's easy enough to create a query which selects
Product-Number and UPC-Code - right?

In the query builder (or SQL if you prefer) modify the term:
[Product-Number]
....to become:
OLD: "REN "& [Product-Number] & ".jpg "

Then, when you run that, you should see in the output a column headed
"OLD" with lines like this:

REN 123456.jpg
.... followed by the relevant UPC Code.

Then do the same for the second term, so:
[UPC-Code]
... becomes:
NEW:[UPC-Code] & ".jpg"

When you run it now, you should see two columns again, but now the
second one is headed "NEW" and each line should contain something like:
REN 123456.jpg UPC-abcdef.jpg

Publish it to Excel, and save it as a tab-separated file, and then
change the extension to .cmd.

Vital-step: make a copy of the whole folder first!

Then run the script you just created (edit out the header line first).

Caveat, it's late in the evening and this is an untested
"thought-experiment" so watch out!

Phil, London
.
 
Ok, nobody's born knowing this stuff, and it's ok to ask for help as long as
you're prepared to work at it a little.

There are a zillion ways of doing this, but you have the existing names in
Access so that's a good starting point. Essentially I've suggested you
extract a list of file names from Access, modifying the Query that does this
so that it produces a script (involving the REN command which renames files)
which you can run to make the changes. I've assumed from what you've said
below that the names are unique in both fields - they'd have to be for this
method to work. Make sure we know enough about the values which are in
these fields to be giving you appropriate advice.

"Product Number" is now "Group", and "UPC-Code" is now "SKU" - is that what
you're saying?

Do you know about queries, and what I mean by the query-builder? Can you
write a query which selects Group and SKU? If so, create the query then
look at the query in "SQL View" (see Help to find out how). Copy the SQL
and post it here.

If you're not ready for that, you'll need to learn about queries. Here's
one place to start:
http://office.microsoft.com/training/training.aspx?AssetID=RC010776611033

Phil

Mike B said:
Sorry for the delay. My first post was kind of vague on some details. I'm
not
all that familiar with Access so let me start over. The database that I am
using has a table called ITEMFILE. The pictures are named according to the
field "GROUP" and I need to rename them to match the corresponding field
"SKU"

The pictures are stored on another drive (e:) and the database file is on
c: (I can move both to the same location if need be). Also, would there be
an
easier way to do this? Excel for example? I don't have to use Access, it
is
just how I saw it done. Thanks for your patience!

Mike

Philip Herlihy said:
Mike said:
I have a database for a store that contains all my inventory
information.
These items also have a picture assigned to them. Right now the
pictures are
named according to their inventory number in the "Product Number"
field. What
I need to do is rename them according to the, for example, "UPC Code"
field.

I know that there is a way to do this because someone showed me but it
was a
while ago and I cannot remember how they did it. The end result was
they
created the code in Access (I think they used the query mode) then
saved it
in a text file which they renamed as a .bat file so when you open it,
the
command line opens and begins renaming the files. If any one could
help, I
would greatly appreciate it. Thank you.

I'm assuming it's easy enough to create a query which selects
Product-Number and UPC-Code - right?

In the query builder (or SQL if you prefer) modify the term:
[Product-Number]
....to become:
OLD: "REN "& [Product-Number] & ".jpg "

Then, when you run that, you should see in the output a column headed
"OLD" with lines like this:

REN 123456.jpg
.... followed by the relevant UPC Code.

Then do the same for the second term, so:
[UPC-Code]
... becomes:
NEW:[UPC-Code] & ".jpg"

When you run it now, you should see two columns again, but now the
second one is headed "NEW" and each line should contain something like:
REN 123456.jpg UPC-abcdef.jpg

Publish it to Excel, and save it as a tab-separated file, and then
change the extension to .cmd.

Vital-step: make a copy of the whole folder first!

Then run the script you just created (edit out the header line first).

Caveat, it's late in the evening and this is an untested
"thought-experiment" so watch out!

Phil, London
.
 
Back
Top