Sorting Files based on Name & Creating new folders


Condition should Like the above one some how the underscore is replaced as italic formats


Thanks @Sudharsan_Ka

Definitely the customer name is dynamic thus it can’t be known, but the file name will always be something like that “FName LName_Report_25072019”.
Will the mentioned condition in the image work in that case?


You need to assign the dynamic customer name in the variable CustomernameVariable

That is

CustomernameVariable= Row(“Customername”).ToString

CustomenameVariable= Chandler Bing


Didn’t get that: Row(“Customername”).Tostring

Can you please explain ?

Thanks for your help @Sudharsan_Ka.

Even if trying to assign custname = row(“customername”).ToString

Facing an error that ROW isn’t declared

You haven’t used for each row in datatable?

I thought you have used for each row in datatable so I said that row (“current folder”).ToString

Okay leave that


No no, my files are getting downloaded into a folder and I have to sort them based on the condition mentioned above…

Thanks @Sudharsan_Ka

@MHarakeh ,

Apologies for the late reply.

If the Customer Name is dynamic, then we could for the below Expression :


Let us know if this works.

@supermanPunch no worries,

it threw back that error :


Remove the * before underscore


Thank you so much guys @Sudharsan_Ka @supermanPunch, your help is really appreciated !

I just have two concerns :
1)when am creating a folder having todays date as name:
today = Datetime.Now.ToString(“dd/MM/yyyy”)
then creating folder using “Today” it’s creating a folder with today’s date and inside the folder a folder with the current month and then inside it a folder with current year ! any idea what am I doing wrong ?

  1. when trying to assign the latest downloaded file
    dfile = Directory.GetFiles(dfilepath,“*.zip”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

Am getting the following :

Remove those double quotes and change the double quotes manually there


What I don’t understand is you are creating a folder with current date which will have current month and current year within itself


What I need here is to create a folder within current system date (30/10/2022)
But am getting year within month within day.


@MHarakeh ,

Could not clearly visualize the process, Could you maybe provide Screenshots of the Implementation that does these Steps ? Creating Year and Month folders ? (I believe this was not the one we suggested above)

Initial Requirement :

It is regarding this point ( If it doesn’t follow the above format I should create a new folder with today’s date (format MMDDYYYY ) and move them there. )

I’m able to create the folder but as mentioned it’s created (dd) then inside (MM) then inside (YYYY).

In the assign activity : Today = Datetime.Now.ToString(“dd/MM/yyyy”)

@MHarakeh ,

As you have mentioned the Folder Name in this way, It is creating the Month and Year folders as well, Since / is treated as a Path not as a Literal. We cannot create a Folder normally in that name format as well.

@MHarakeh ,

The Suggested format initially is as shown above. (ddMMyyyy)

@supermanPunch I used the mentioned and it worked :slight_smile:

THANK YOU SO MUCH @supermanPunch @Sudharsan_Ka Much appreciated


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.