Jump to content
Macro Express Forums

Rename all files in folder


Langusmon
 Share

Recommended Posts

Hello,

 

I am trying to take a folder that has say, 10,000 files in it, and add a .txt extenstion to the end of each either through the means of converting each file or renaming each file to put .txt on the end of the filename. The latter option I was thinking would be the easiest.

 

Im trying to use the the Repeat with Folder option, but am unable to figure out how to go through each file in the folder to do this.

 

Any help would be much appreciated!

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I am trying to take a folder that has say, 10,000 files in it, and add a .txt extension to the end of each either through the means of converting each file or renaming each file to put .txt on the end of the file name. The latter option I was thinking would be the easiest.

 

I'm trying to use the the Repeat with Folder option, but am unable to figure out how to go through each file in the folder to do this.

 

Any help would be much appreciated!

 

I did something similar with a macro I wrote awhile back. What I ended up doing was writing a batch script that would navigate to the folder and make a file list. And then execute the batch scrip from with the Activate/Launch function in Macro Express. Here is some example batch script:

 

c:

cd "C:\Desired Folder Location"

dir /b /od > "Text File Name.TXT"

 

You will want to put that in a test file with a .BAT extension on it. That will then navigate to your folder and dump all the file names into the "Text File Name.TXT" file in the order they were created or modified. You can then use the Process Text File function in Macro Express to load the file names line by line then use the Rename function to make any changes that you need.

 

PS you can pass variables to batch scripts as well if you add command line paramaters. Variable in batch scripts start with %1 and ascend %2 %3 ect.

Link to comment
Share on other sites

  • 6 years later...

You do not need a macro to do this. Old-style DOS commands make short work of the job of renaming files en masse.

 

1. In the "Run" dialog type "cmd" and press Enter.

 

2. You should now be at a DOS prompt.

3. Navigate to the folder you want to act on using "cd" (change directory) commands, e.g.,

cd c:\Users\SSmith\Links

4. To rename every file in the folder, type this at the prompt:

ren *.* *.*.txt    and then press Enter.

Translation: rename (ren) every file in this format:

name.extension

to this:

name.extension.txt

The "ren" command will rename the files in a blink of an eye.

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

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

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

Loading...
 Share

×
×
  • Create New...