none
Azure power Shell script to look for a file in Data lake store Gen 1 and trigger a BAT file RRS feed

  • Question

  • Param (
        #[string]$Path = "C:\Temp"
        [string]$Path = Test-AzureRmDataLakeStoreItem -AccountName "aruntesting1" -Path "/MyFiles/test.csv" 
        )
    
    ### Look for any files from the path mentioned above
        $watcher = New-Object System.IO.FileSystemWatcher
        $watcher.Path = $Path
        $watcher.Filter = "*.*"
        $watcher.IncludeSubdirectories = $true
        $watcher.EnableRaisingEvents = $true  
    
    ### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
        $action = { 
                    $A = Start-Process -FilePath C:\Users\arsivana\Desktop\Arun\Project\xyz\test.bat -Wait -passthru;$a.ExitCode
                  } 
    
    
    ### Events to be watched 
        Register-ObjectEvent $watcher "Created" -Action $action
        Register-ObjectEvent $watcher "Changed" -Action $action
        Register-ObjectEvent $watcher "Deleted" -Action $action
        Register-ObjectEvent $watcher "Renamed" -Action $action
        while ($true) {sleep 2}

    Arun

    Monday, October 14, 2019 12:58 PM

All replies

  • I need to run a BAT file once the file is available in Azure Data lake Storage - Gen 1. I have the PowerShell script which does the folder check from my C:\Temp, but I need this to be changed to Azure Data lake storage path location.

    Instead of C:\Temp I use AzureRmDataLakeStoreItem, but facing errors in this.


    Arun

    Monday, October 14, 2019 5:10 PM
  • Hello Arunachalam,

    We are just checking if you have a resolution , if yes please do share the resolution with the community as this may benefit others . Otherwise please do share the things which you have tried ( if any) and we will try to help .



    Thanks Himanshu

    Thursday, November 7, 2019 7:18 PM
    Moderator