Jump to content
Macro Express Forums

Link File Names to text File

Recommended Posts

I have a folder on my hard drive that contains hundreds of JPG images. I would like to list them all in a text document.


'm trying to find a way to capture the name of every file and enter the name into a text document. After all of the files are entered into the document my goal is to import the text document into Access.
I was trying to accomplish this with the use of an Access program. I tried several different forms and no one could come up with a solution. Then I started thinking about Macro Expression. Am thinking that it should be able to do that I just don't know the direction to start with.
Link to comment
Share on other sites

Use the Repeat with Folder command and write each name to a file using the Variable Modify with the option to append a CR LF (end of line). I suggest you also check the attributes of the file and skip those that are hidden. If it's a Windows machine there will be a hidden thumbnail Db file in the folder. If there are a lot of files and it runs slow I would assemble all the names into a variable and write that at once when the loop is complete.


If your ultimate goal is an Access Db I would write a VBA routine to do this directly in your Db. If this is beyond your skill set you could hire me to write it for you.

Link to comment
Share on other sites

Using Macro Express Pro:


Repeat with Folder E:\temp
  Variable Modify String: Append %A_File% to text file, "E:\temp\files.txt"
End Repeat

If you only need to do this once you can do this manually:

Win+R (to bring up the run dialog)



In the command prompt type something like this (follow each line with <ENTER>):


cd \photos

dir *.jpg >files.txt


To close command prompt


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...