Get only todays files from folder

Hi Friends,

How we take the files (Only todays date file )from folder.
Here files can be more than one.
How we can achieve this.

Thanks

1 Like

Hi @Rup_1

Whether file name Consists of Todays date or Get By Modified Date?

Regards

Hi

Hope these steps would help you resolve this

— use a assign activity like this

arr_filepath = Directory.GetFiles(DestinationFilePath, “.”)

This will give array of file path

— now use a FOR EACH activity where pass the above array activity as input and change the type argument as string

— inside the loop use a IF condition like this

System.IO.FileInfo(item.ToString).CreationItem.ToString(“dd/MM/yyyy”).Equals(Datetime.Now.ToString(“dd/MM/yyyy”))

—if true it goes to THEN block where use a
ADD TO COLLECTIONS activity
Where in property
Mention the Collections as listfiles

Where listfiles is a variable of type System.Collections.Generic.List(of string)
With default value defined in variable panel as New List(of string)

And in item property mention as item.ToString
And change the Argument as string

Now this listfiles variable will have the file created for today

Now you can use this list variable in a for each loop and save anywhere you want

Cheers @Rup_1

@Rup_1

New directoryinfo(yourpath).getfiles().where(function(x) x.creationtime.date=now.date).toarray

IT will Return an Array of Fileinfo objects of todays Files. Accessing the filepath can be Done by myFileInfoVar.FullName

Could look like this
grafik

Find starter help
Demo_GetFilesByXDate.xaml (6.0 KB)

2 Likes

Is this working fine @Rup_1

Cheers

Hi @Rup_1

Follow the Steps

  1. Goto Filters and select the Studio X
    image

  2. Search for “For each file in folder” you can order by your requirements(In Your case “Last updated newest first”)
    image

Hope it Helps

Regards
Sudharsan