msibleyj Posted March 18, 2023 Report Share Posted March 18, 2023 I'm using the Process Folder macro to go through a directory of files and process them in a program. But, I need to append some text to the filename each time I finish the processing. The Process Folder scripts reads the filenames into the array %T[1]% and iterates through the array. When I need to save the file that just been processed, I need to add "_LE" to the end of the filename without changing the extension. For example: the original file might be named foo.bar but I need to name the newly processed file as foo_LE.bar. I assume I could split the text into parts somehow and concatenate afterwards. Thanks, Mark Quote Link to comment Share on other sites More sharing options...
rberq Posted March 18, 2023 Report Share Posted March 18, 2023 IF there is only one period in the name, just before the extension, you can use Variable Modify String to change the substring "." to "_LE.". Quote Link to comment Share on other sites More sharing options...
msibleyj Posted March 18, 2023 Author Report Share Posted March 18, 2023 Thanks rberq. I think I accomplished the same thing with this ugly hack: Repeat with Folder C:\foo\bar Variable Set String %FileExt% to "%T[1]%" Split String "%FileExt%" on "." into %parts%, starting at 1 Variable Set String %dir% to "C:\foo\bar\" ... Text Type (Simulate Keystrokes): %dir%%parts[1]%_LE.txt Yours, of course, is more elegant. Kindly, Mark Quote Link to comment Share on other sites More sharing options...
Cory Posted March 27, 2023 Report Share Posted March 27, 2023 You can also easily rename them from the command line or batch file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.