This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
How can I change the file name of multiple files at one time? They all currently have different names and I want to change them so that each one will have a different name with the same number (year) on the end.
Are you trying to write multiple files and have each one with a different name with the same year number, or you're just trying to change the names of files in a directory on your computer?
If you're trying to write multiple files, you can add a field with the name you'd like to all records to be written in that file, and then select the "Take File/Table Name From Field" configuration at the bottom, and select "Change File/Table Name" from the drop down menu.
In order to get the same year number in each one, you could create this "file_name" field using a formula.
I can go a little more in depth if you need once you let me know a little more about the problem.
I am reorganizing several thousand files that are located in folders by year and then by month. I have a batch macro that is copying the files from the archived folder into a new location. I'd like to change the names of the files after I've copied them over to the new folder. Each subfolder has the same/similar file names so when copying them over I'd like to identify them by the month/year they came from. For example if a file came from the January folder and the 2001 subfolder and was called "apple" I'd like to change the name to "APPLE 01_01"
So it sounds like you're reading in each of the files, then outputting them to the new folder. In this case, the approach I mentioned above should work, provided you can find a way to create this new file.
Is it possible for you to provide a screenshot of your batch macro? It would make it easier to identify the best way to do this.
What is your batch macro's Grouping Field? Do you have year/month information in the records contained within the files?
If you're using the Directory tool to read in all these files in each folder, you could perhaps take the file name from there, and add the year/month information from the file, or if your batch macro groups on year/month, you could perhaps try and get it from there.
In general, you'll want to add a formula tool creating a field called "file_name" with an expression like:
Yes I am changing the file type and outputting to a different folder. I don't have a Grouping Field. I'm not sure where this is located. The year/month is not located in the folders. I am using the directory tool with the macro attached to pull the files and output to a specific folder (which I have just been changing the directory input and the output in the macro).
You could also add in a step of logic which would convert the month names into numbers if you desired instead of using the raw month string.
Without an idea about the directory structure it will be hard for me to develop a RegEx to parse it properly, I recommend using RegEx101 to do some testing and figure out exactly how you want to do this. You'll want to find a way to immediately remove the whole "C:/Users/User/Documents".... or whatever, until you're left with a string similar to my "Field1" in the workflow, with only the information you want (year, month, filename). You could do so with a RegEx Tool set to "Replace", where you look for the year, and replace everything before it with "", a blank string. If you need me to clear up what the RegEx I've used here is doing just let me know.