Can we use wildcard in string

@Jobin_Joy
Can we use whildcard in string value {Assign Activity}

“C:\Users\Downloads\excel/” + today.ToString(“MMMMyyyy”)+“/SpotsReport_”+Today.Tostring(“dd_MM_yyyy_”)+“4567865.zip”

4567865 replace this value with whildcard.

Using Assign Activity

Hi @Dmitri00007

You can use like below,

“C:\Users\Downloads\excel/” + today.ToString(“MMMMyyyy”)+“/SpotsReport_”+Today.Tostring(“dd_MM_yyyy_”)+“ *.zip”

To know more about Wildcard, please refer the below link.

Hope this will be helpful. Thank you.

@Dmitri00007

You can use to get all the Zip files in a directory as below

Directory.GetFiles(“yourDirectory”,“*.ZIP”)

Hope this will help you

Thanks

Noted a wrong slash here instead of “/” we have to use this \ . Please change it as below.

“C:\Users\Downloads\excel\” + today.ToString(“MMMMyyyy”)+“\SpotsReport_”+Today.Tostring(“dd_MM_yyyy_”)+“ *.zip”

Thank you.

I use this same code and its not working. It says file not exist

I’m using this in Assign activity then pass the variable to File exist activity then to If activity and at last message box on both side.

Hi,

I think you kept underscore in wrong place…try below expression. And if it not work share the sample file full path so that we could help you better. Thanks.

“C:\Users\Downloads\excel\” + Now.ToString(“MMMMyyyy”)+“\SpotsReport_”+Now.Tostring(“dd_MM_yyyy”)+“_”+“ *.zip”

Hey one more point you can not use wild card file path for file exist.

Try with suggestion shared by @Srini84

I’m using FTP server to download the file, that’s why its / instead of \ .
but the whildcard isn’t working, both in Pc and ftp.

Hi,

If you want latest downloaded zip file name from downloads folder. Please use below expression. After that you could concat this latest file name to your downloads folder and check for file exist if you want. Try and let me know. Thanks.

Directory.GetFiles(your downloads folder path).[Select](Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(“.zip”)).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString()

@Jobin_Joy @kirankumar.mahanthi1
I’m trying to download the latest file from FTP server.

File name SpotsReport_20_12_2021_4567865
SpotsReport is same on daily report
20_12_2021 date is changing daily according to current date
4567865 this number is system generated and in simple terms its a random number.

now when I’m using this code
“Ftp_folder_path/”+ToString(“MMMMyyyy”)+“/SpotsReport_”+Today.Tostring(“dd_MM_yyyy_”)+“4567865.zip”

then I’m able to fetch the file but when I’m trying to use whildcard, it says file not exist.

I want to download latest file in the folder.

this code is not working on FTP server

Hi,

Don’t use this expression on server. After downloading latest zip file will be on downloads folder C:\Users\Downloads\excel\

Use this folder path in that expression to find out the latest downloaded zip file name. I hope you understood. Thanks

ok on FTP server, there’s a folder by month+year (December2021) in this folder there’s are reports which upload on daily basis

format of file name - SpotsReport_20_12_2021_4567865.zip
SpotsReport is same on daily report
20_12_2021 date is changing daily according to current date
4567865 this number is system generated and in simple terms its a random number.

I need to download the latest file and only one single file.

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