title: TwinCAT - How to check contents of a directory from Beckhoff PLC
body: <p>I am trying to perform file management within the PLC. Currently, NT_StartProcess works as follows, but I will not have any feedback after the process has been spawned. Is there a way to check the contents of a directory from the PLC? Is there any way to get feedback from NT_StartProcess?</p>
  <pre><code>// File Locations
  sTargetFilePath := 'C:\LocalHistory\test.job';
  sTargetDirectory := 'C:\\CustomerDir';
   
  // Build Command String
  sCommand := '/C ';                  // Special command indicating command string input
  sCommand := CONCAT(sCommand, 'move ');      // Add move command
  sCommand := CONCAT(sCommand, sTargetFilePath);  // Add target file
  sCommand := CONCAT(sCommand, ' ');          // Required space for command 
  sCommand := CONCAT(sCommand, sTargetDirectory); // Add target location
   
  // Output -&gt; ‘/C move C:\NET-DRIVE\NewOrders\Original.xml 'C:\NET-DRIVE\OldOrders’
   
   
   
  Process(
      NETID := '',                    // Local System
      PATHSTR := 'C:\Windows\System32\cmd.exe',   // Path to local cmd executable
      COMNDLINE := sCommand,          // Comnmand to be executed
      ERR =&gt; bError,                   // Error Output
      ERRID =&gt; iErrorId                // Error Id Output
  );
   
  // Trigger Command
  IF bTrigger THEN
      bTrigger := FALSE;
      Process(START:=TRUE);
      Process(START:=FALSE);
  END_IF
  </code></pre>