Downloaded item is a file or a folder check

Hi All,

want a help in below scenario

I am downloading a item from web and unzipping it, item can be either a file or a folder but only folder can be unzipped so i want a condition to check that the downloaded item is a file or a folder.

How can I check that?


You can check it based on extension. For zip extension will be .zip…

Path.GetFileExtention(downloaded file path)

Hi @Dhruvi_Arumugam ,

In IF activity try this expression Path.GetExtension(full path of downloaded file).Equals(".zip"), if it is a zip file the condition will be true and in Then part you can add the unzip steps and if it failure the it’s an file.

Happy Learning
Achal Sharma

Hi @Dhruvi_Arumugam

Did it work?

Hello @Dhruvi_Arumugam

You can add an assign activity and check the below condition.
var= Directory.GetFiles(“Your folder”,“*.zip”,SearchOption.AllDirectories)

Then use a if condtion
if(var.length>0), then use unzip activity.

var.length will give the length of the array. So if any files found with .zip the size of array will be more than 0