How to know the File Type

Hello,

I have multiple files in my Directory. And I am verifying one by one, where if the file is zip file then I want to extract it. So I want to know the file type. How to do it?

Regards,
Hemal

https://msdn.microsoft.com/en-us/library/system.io.path.getextension(v=vs.110).aspx

like above thread compare with your .zip.
or

you can get only all zip files from directotr and traverse it as per your needs.

Directory.GetFiles(folder_path,".zip",SearchOption.AllDirectories)

Regards…!!
Aksh

2 Likes

Regarding the extract part…fyi

2 Likes

Thank you so much. I have done it :slight_smile:

hello,
can you help me out with unzipping a file actually the zip file i am trying to access is xlsx having password to open it,when i am trying to open it using this activity it gives me a blank xlsx sheet. is there a solution for it @vvaidya

Hi @Priya_Pandey,

Let me know the issue will help it. R u giving the proper name with that particular sheet ?
One more thing is use that kill the process activity… which will kill the xlsx files whichever r open.

Regards,
Hemal

yes i am using a proper name, and i am working using reframework so its already killing all open files,
actually when i am trying to manually extract the zip file its asking for password, i guess this is the reason after getting file in unzipped format its blank because without password it cannot extract the data from it.

Hi @Priya_Pandey,

Right. That’s the main reason. For the security reasons if you have provided the password then the first thing is you can use attended.

The second thing is, make the email notification when your excel files will be downloaded so you can manually give the password and then start working for the next process.

Third is, Use BalaReva Excel Activites where there are so many activites for Excel, in which one of the activities is Set Password.

Thanks & Regards,
Hemal