Jump to content
Macro Express Forums

Create a text file consisting of the names of every object in a folder

Recommended Posts

I want to generate a file that contains the names of every folder and every file in a particular folder. I am trying to avoid a clunky solution like this:

Repeat the number of objects in the folder

	Press F2   // Rename the item, which causes the object to be selected

	Clipboard Copy

	Press Esc  // Escape from rename

	Switch to an open file

	Clipboard Paste

	Switch to the list of folders and files

	Press Down Arrow  // Navigate to the next item

Repeat End	

I should be able to do this from the command line using this:

dir > list.txt

But I do not have administrative rights to access the folder from the command prompt.

Looking forward to seeing your cool MEP ideas!


Link to comment
Share on other sites

I figured it out... and only three lines of code for the folder names, and three more lines for the file names.

<REPEAT WITH FOLDER Path="C:\\Users\\Alan\\Documents\\Test" OnlyFiles="FALSE" Destination="%x%" FullPath="FALSE" ProcSubfolders="FALSE"/>
<TEXT TYPE Action="0" Text="%x%<ENTER>"/>

Repeat with Folder C:\Users\Alan\Documents\Test
  Text Type (Simulate Keystrokes): %x%<ENTER>
End Repeat


Another example of the versatility of Macro Express Pro!

Link to comment
Share on other sites

  • 4 weeks later...

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...