Hello Guys,
I have a file , I need to check its extension.
How can I do that?
Hello Guys,
I have a file , I need to check its extension.
How can I do that?
Hi @Karan28
try this to get specific format files in directory Directory.GetFiles(folder_path,“.xlsx”,SearchOption.AllDirectories)`
try like this path.getextension(file_Path) this will gives you file path extension and then check like in if condition path.getFileextension(file_Path) = “xlsx”
Use assign activity to get file extension.
FileName=“Abc.xlsx”
Extension=Path.GetExtension(FileName)
I have applied this with the help of if statement but condition is giving false means going to else part
can you please share that screen shot here and what file you are checking if possible
This expression would help you resolve this
Path.GetFileExtension(“Yourfilename.xlsx”).ToString.Contains(“xlsx”)
Cheers @Karan28
here var = “C:\Users\karan.arora\Desktop\TimesheetReportExtraction\data\User Input.xlsx\User Input.xlsx”
GetFileExtension will give us with . Along the file extension
So use contains like this
Path.GetFileExtension(“Yourfilename.xlsx”).ToString.Contains(“xlsx”)
Cheers @Karan28
Thankyou so much , it worked
Just In case one doubt, I am downloading the attachment using save attachment activity
I need to check the extension of that attachment and I am giving the folder path to save the attachment in save attachment activity.
I need to check if the folder contains xlsx file or not
yah with PATH EXISTS activity itself we can get that boolean output where mention the same file path so that it will tell whether its there or not
Cheers @Karan28
yes but I need to check the extension of that file , I dont know the name of the file
I need to check the extension of the file present in the folder and I know the folder path
I guess it will be done by directory.getfiles
this would help you
karan.zip (2.2 KB)
Hello @prakaz25 I guess your solution is quite close.
I have the folder path and I am saving an attachment in that path and I need to check if the downloaded file in that folder is of xlsx or not?
did this help you
@Karan28
While saving itself you have check the file extension, as
Path.GetExtension("yourFilePathwithExtension") =".xlsx"
Hello , I Like this logic I am just implementing
I am not getting name after mails
like mails.name.
Already Tried this sarathi125
So what you want to check then