How to detect if there is files in a window directory

Hi,

Is there a way that I can check if there are files inside a directory. If I have to use List Iterator operation, I have to manually hard-code list of file names. I still haven't succeed with hard-code list, anyway. I am exploring option not to have hard-code list.

Thanks you in advance.

Regards,

joe

  • There are multiple ways to do this obviously.

    Strictly using OO operations you can  go for the option  of Get children from path to see if there is anything in the directory  and then iterate / multi instance through the list to see if there are files in that directory. Everything done utilizing the results of the operations, no hardcoded values required.

    For directories which contain a lot of  files and folders this may take a long time and  be quite inefficient. 

    If powershell usage is available you could simply query powershell for the list of files in the directory. For example see the following command: "Get-ChildItem -Path C:\Temp\Workspace -Recurse –File" which you can trigger through the powershell command operation.

    Hope this helps,

    Vlad

     

  • Thanks for sharing your idea. Do you have any sample code that can share with me. New to OO and still struggling to digest it. 

     

    Thanks,

    joe