Page 1 of 1

Sort folder based on filename inside the folder?

Posted: Fri Jun 18, 2021 5:51 pm
by automation
I have folders with one XML-file and two PDF-files like this

-Folder1
--AAA_I.pdf
--AAA_C.pdf
--CCC.xml

-Folder2
--BBB_I_Lex.pdf
--BBB_C_Lex.pdf
--CCC.xml

As you can se Folder1 does not have "_Lex" in the end of the pdf-files. But the pdf-files in Folder2 have "_Lex" in the end.

I want to sort all the folders (not only the files) that have pdf-files with lex inside it to one folder and all folders that doses not have lex in the file to another folder. The folder should after sorting contain the same files, one XML and two pdf-files.

Re: Sort folder based on filename inside the folder?

Posted: Mon Jun 21, 2021 8:40 am
by freddyp
Have a look at what the variable [Job.NestedName] can do for you in a condition with variables so you can separate the job folders with a file containing _Lex_ inside and the ones without.

[Job.NestedName] returns all the filenames in the job folder so you can check whether there is a filename that contain _Lex_. You will have to experiment a bit with "Action-Index" and "Action-Separator". Perhaps the choice of a certain "Action-Index" can let you pick a filename that you can check for "contains _Lex_"? Or perhaps you have to take all filenames (Action-Separator) and check for the presence of _Lex_?