Forum Discussion

NisHera's avatar
NisHera
Valued Contributor
11 years ago

Copy file in unknown sub directory

How can i copy file in known directory un- known sub directory eg my application generate xml file. It is placed in spool directory and sub derectory with random name  like C:\Spool\78283...
  • HKosova's avatar
    11 years ago
    You can use aqFileSystem.FindFiles to find the file by its partial path, and then copy the found file.



    //JScript

    var foundFiles = aqFileSystem.FindFiles("C:\\Spool", "*.xml", true /* search subfolders */);

    if (foundFiles != null)

    {

      foundFiles(0).Copy("C:\\myfolder\\New.XML", true);

    }

    else

    {

      Log.Error("File not found");

    }