Closed Thread
Results 1 to 16 of 16

import file names from images

  1. #1
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    import file names from images

    I've got 1,000s of images that I need to import the file names into excel so I can map them to the relevant products. Is there a way to import all the image names froma specific folder on my computer into excel?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    re: import file names from images

    I started collating several routines that I found for browsing for a folder and then listing the files in the folder.

    It doesn't actually matter that they're images or whatever.

    The collection is in the attached workbook. Enjoy.

    Note that some of the options will not work in Excel 2007 and above.

    Regards
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    162

    re: import file names from images

    nice collection TMShucks, very useful.

  4. #4
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    re: import file names from images

    Great, thanks for that - Ill give it a go

  5. #5
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    re: import file names from images

    I'm trying to find someone with a copy of excel 2003 or below to give this a try, does anyone else have anything that will work on 2007 or 2010?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: import file names from images

    Try this, you can adapt it for what you need.

    List Files
    Attached Files Attached Files
    Last edited by royUK; 03-20-2011 at 06:48 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: import file names from images

    Quote Originally Posted by royUK View Post
    Try this, you can adapt it for what you need.

    List Files
    Thanks for that, when I click on the list files macro and browse to the folder it then inputs into cell A! "Files in z:\My Pictures\Pre Cut Patterns\Alfa" and doesnt show any of the file names, I assume Im doing something wrong or missing a step.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: import file names from images

    you could just run a simple batch file then import result into excel
    in notepad put
    Please Login or Register  to view this content.
    where first bit is where images are and second bit is where you want the text file "list.text" to go ,note the quotes you'll need them if your subdirectory names have spaces like mine do
    save the notepad save as file type all files and name it something like getlist.bat
    double click it to run. The above creates a text file called list.txt of all "my documents" folder on my desktop,
    import the result into excel
    Last edited by martindwilson; 03-21-2011 at 01:55 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: import file names from images

    The code works for me.

  10. #10
    Registered User
    Join Date
    12-04-2009
    Location
    Bromsgrove, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: import file names from images

    Quote Originally Posted by martindwilson View Post
    you could just run a simple batch file then import result into excel
    in notepad put
    Please Login or Register  to view this content.
    where first bit is where images are and second bit is where you want the text file "list.text" to go ,note the quotes you'll need them if your subdirectory names have spaces like mine do
    save the notepad save as file type all files and name it something like getlist.bat
    double click it to run. The above creates a text file called list.txt of all "my documents" folder on my desktop,
    import the result into excel

    Great thanks, do I do that in the run menu inc the "@echo off"?

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: import file names from images

    nope just click the batch file ,oh i see you mean direct in run without a batch file
    no
    open run
    type cmd and enter
    in the cmd.exe window paste in
    dir "C:\Documents and Settings\Martin Wilson\My Documents" > "C:\Documents and Settings\Martin Wilson\Desktop\list.txt"
    enter and it will do the same

  12. #12
    Registered User
    Join Date
    05-05-2014
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: import file names from images

    HI TMS,

    I used your code and thanks it works! You're great!

    I also want to get the dimension of the photos, could you help me? thanks!
    Last edited by mark_anthony; 05-06-2014 at 02:37 AM.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,091

    Re: import file names from images

    Hi mark_anthony, and welcome to the forum.


    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  14. #14
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Pune
    MS-Off Ver
    Office 365 (Win 10)
    Posts
    489

    Re: import file names from images

    I use this
    Attached Files Attached Files
    Please make the Post as solved, when you get your answer & Click * if you like my suggestion

  15. #15
    Registered User
    Join Date
    05-05-2014
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: import file names from images

    Hi TMS, sorry for this.

    Thanks for your reminder.

  16. #16
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: import file names from images

    akhileshgs

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction then send a private message to them asking for clarification. Do not post a reply in a thread where a moderator has requested an action that has not yet been complied with e.g Title change or Code tags...etc
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1