I am getting a list of the files from the directory in the folder. How we can get the files extensions (.xlsx or xls or jpeg or pdf or docx) from the folder. Please find the attached screenshot for your reference. Could you pls help us with this scenario.
Hello @Kiran When you say ‘you are getting list of files’ means I am assuming you are using ‘List Directory Files’ activity. When you use list directory files activity, result will be stored in directory_files variables which contains extensions along with filename.
Thanks for responding. @Kudlappa_Gouder .
We are getting the same format in Variable. After getting the result we need to do some IF conditions based on the files format extensions. What i need to pass in IF condition (to get only PDF file). Pls refer to the screenshot.
@Kiran You can use below IF statement
if(directory_files[i].indexOf(‘pdf’) !== -1)
You can loop through each file to find whether it contains pdf or not.
@Kiran It’s not possible to share the .neek file in the forum. You can send me the value you are getting in the ‘directory_files’ variable(click on Show source value check box and send the Json format value) so I can give you the exact condition to use
I’m new to ElectroNeek and trying to find a way to check if Directory Files return results has any list of documents with extension “zip”. This is the output of the Directory Lists…
@g.melihov , @Fernanda_Costa , I think it’s a good area for future improvements. The task is straightforward (and common), but the way of solving is not super simple now. Take a look, please.
Thanks @Kudlappa_Gouder I managed to get my flow working. I guess for this kind of small/common automation, it should be easy to configure. I’m now trying to understand the UNZIP and Move file activities. There’s a description for these activities under help but no examples. My workflow is failing to unzip the files to the predefined DIR location in a variable.
@Kiran_Yadavalli You need to write If condition within loop so that it will check each file to know whether it contains zip or not. Find the screenshot below.
If you are still facing the issue I would suggest you to contact support team(If in case you are missing some logic in the workflow, they can take a look and help you quickly).
Hello @asharma I am guessing you are facing issue where you are using dynamic value of path. Try to use double slashes instead of single slash in the path
for example :
if variable pt = C:\Users\MUTTU\Downloads\Export then change it to below
I know I am assuming the issue but this is the common mistakes I see while using dynamic paths.
You can give more information here to understand the issue if its not the above one.
Thanks @Kudlappa_Gouder for the path pointer. I did had double \ in the folder path VAR but it looks like it’s failing when unzipping the file. Getting “ENOENT: no such file or directory” error.
I’ll escalate it to support not sure what ENOENT means but thanks for your help. Just started playing with tool today and trying to build some concept of exporting attachments from mailbox and if there’s a zipped attachment , unzip it to location.
In that case your algorithm does not have to use that many JS calculations even if you are used to them. Just on each iteration, call the activity and do the if part.
In the meantime, if you are willing to use JavaScript for some reasons, it is also not necessary to use if for that. You can use an anonymous function like this:
This topic is very fascinating, but I agree with @Yudovskiy that this is a good area for future improvement because this task is definitely straightforward; however, the process for performing this is not. Every process needs to be streamlined so that the software is seen as extremely ideal for all situations. Additionally, as I know there is a technical writer on staff to enhance all aspects of training, these types of scenarios need to be fully captured in detailed steps with screenshots, etc. Love all of the feedback!