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.
Yes. The subdirectory already exists and it's empty. I will explain myself in detail:
1. I have plenty of directories with "dates", for example 2016.01, 2016.02, 2016.03, which are basically results by period.
2. What I need to do is open an specific one which link is "G:/BASES/SAVINGS/RESULTS/2018.02/DATA/FILE_10.txt", what I need to do is changing the period because the same File_10.txt is in every subdirectory (2018.02,2018.03).
3. After open the specific file_10.txt I need to do some treatment like changing some fields with formulas and after that I need to save it in the same directory but with another name and in a different subdirectory. "G:/BASES/SAVINGS/RESULTS/2018.02/ASSIGNMENT/ASSIGN_10.txt".
I need to do it to 60 files that have the same schema.
Got it. As long as the the target folder is in the place, A Directory tool and Dynamic Input tool pairing will make this a snap. Here's an overview of how I imagine this happening:
- A Directory Input tool will be pointed to "G:/BASES/SAVINGS/RESULTS/" with a target file type of ".txt"
- Use the FullPath field from the Directory tool to feed a Dynamic Input tool. Be sure to configure the Dynamic Input to include the file path as a field (it's a checkbox option).
- The Dynamic Input will go through the list of files and open them all. This is why you need the file path as a field to keep things organized. Be sure to include that field as a group by option while modifying the contents.
- Use a Formula tool to update the filepath to the new location with an expression that looks like this Replace([FullPath],"/DATA/FILE_","/ASSIGNMENT/ASSIGN_")
- Configure an Output tool to "Take File/Table Name from Field" and use the file path you have modified to the new location.
I'd build an example, but since the folder structure wouldn't package with it, it might not be helpful. Let me know if you have any questions on a particular step in the process.
I try it but I don't want to open all the files that have the same name, I want to do it iteratively. Because the process that I need to do is per period. I will attatch a photo about it
As you can see at file "CAPA_10.txt" is in every subdirectory that I have:
What I need to do is open the specific file "CAPA_10.txt" later make some threatment (lef_join,formulas,uniques,select) After all this process I need to save it as the same name by subdirectory (Assignment_10.txt) but it should be in every period (2018.01,2018.02,2018.03,etc.) like this:
As long as you use the entire file path and not just the file name, everything should stay organized. if you'd like to perform this one file at a time, I suggest building this process into a batch macro that uses the full path as the control parameter.