Hi,
I have two files with the same file name but different version. I need to check the latest version and copy them to the folder.
Any ideas on how to implement ?
File names : 10mL ABC 19875-05.pdf
10mL ABC 19875-06.pdf
Currently, I am getting the files in a folder which has 10mL ABC 19875*.pdf, so I am getting all the files which matches. I need to copy the file which has 06.pdf. Please help.
Solved! Go to Solution.
Assuming all files are formatted the same way, ex. ##ml XXX #####-##.pdf, then you could do the following:
This will loop through each filename ignoring the first time the 15-character string pops up. Each line will look for a match from the previous 15 characters, and if they are a match, it will delete the file, if not, it will move on.
Best of Luck!
Hello @Anonymous
Just remove the item %Files[0]% from the list.
After that, you have the list of files except the latest one. That's the list of files you want to delete.
Now you can delete files except the latest one using variable %Files%. It's so simple, but it works well as you imagined. 🙂
Thank you.
Hello @Anonymous
We have "Sort by" dropdown menu in Advanced options in action "Get files in folder". You should make it sort by "Name" and let it "Descending" order in this scenario.
Using configuration above, the latest version of your files will always be at the beginning of the %Files% list.
Then you can copy the latest version of file referring by %Files[0]%.
Thank you.
Thank you @Anonymous
It is so helpful! one more thing, for suppose I have many files having same file names and different version and I have to keep the latest, rest of the files have to be deleted because I am working on the same folder so instead of copying, I prefer to delete the unwanted files.
Assuming all files are formatted the same way, ex. ##ml XXX #####-##.pdf, then you could do the following:
This will loop through each filename ignoring the first time the 15-character string pops up. Each line will look for a match from the previous 15 characters, and if they are a match, it will delete the file, if not, it will move on.
Best of Luck!
Hello @Anonymous
Just remove the item %Files[0]% from the list.
After that, you have the list of files except the latest one. That's the list of files you want to delete.
Now you can delete files except the latest one using variable %Files%. It's so simple, but it works well as you imagined. 🙂
Thank you.
Thanks @Anonymous
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
43 | |
9 | |
8 | |
5 | |
5 |