1 Reply Latest reply: Nov 3, 2017 1:46 PM by Abhay Sudhakaran RSS

    Execute Batch File to Move files between shared folders

    Abhay Sudhakaran

      I am trying to move files between 2 shared folders, for which i would like to use a dynamic batch file that takes parameters.

      Is there a way to get this working in QLik Sense. I remember it used work like (shown below). But for some reason this doesnt work anymore:

       

      SOLUTION 1 (NOT WORKING: AFTER THE RECENT UPGRADE to Qlik June Release)

      // Define Destination Folder Locations

      // Let vDataLake = 'lib://Dev_DataLake';

      Let F1 = '\\Testing\F1\';

      Let F2 = '\\Testing\F2\';

       

      // Function for moving old files to archive

      // ----------------------------------------------------

      SUB Qv.MoveFiles (FileArchive,DestArchive)

       

          Let copycmd = 'cmd.exe /c Move "$(FileArchive)"' & ' "$(DestArchive)"' ;

          EXECUTE $(copycmd);

       

      ENDSUB

       

       

      // Archive Previous Monthly Files

      Let vFileName = '$(F1)' & '*.txt';

      Call Qv.MoveFiles('$(vFileName)','$(F2)');

       

       

      SOLUTION 2 (NOT WORKING : Hard Coded Folder Paths in Batch Script)


      1. Create a batch file called "Move.bat" in the destination folder (with hardcoded folder locations)

      Move /y "\\Testing\F1\*.*" "\\Testing\F2\"

      2. In Load script add this line

      Execute '\\Testing\F1\Move.bat'; or create a folder library path and use that instead

       

      SOLUTION 3 (NOT WORKING : Dynamic Batch Script using parameters)

      1. Create a dynamic batch file

      echo off

      set src=%1

      set dest=%2

      cmd.exe  /c Move  %src% %dest%

       

      2. Add this line in load script

      Execute '\\Testing\F1\Move.bat  "F1" "F2"';



      IMPORTANT NOTE:

      The Settings.ini file looks like this:

      ----------------------------------------------

      [Settings 7]

      OverrideScriptSecurity=1