Sorting an invoice by name

i am building a sequence that download pdf and excel files with names ( name-mm-dd-YYYY.pdf) and need to move those files from its location to different location based on the (YYYY) in the file name like for example , if i have document named XYZ-12082022.pdf and another one abc-12082022.xlsx and want to create folder by the year name and move those two document to two folders one is pdf and the other folder is xlsx.

Hi @Hesham_Elsayed_MiddleEast

You can check the extension and segregate and for extracting the year you can use substring as always the last four digits are year and use that to identify which year it belongs to


HI @Hesham_Elsayed_MiddleEast

str1 = “abc-12082022.xlsx”

getYear = str1.Substring(str1.Split("."c)(0).Length-4,4)

getExtension = str1.Split("."c)(1)