NisHera
11 years agoValued Contributor
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\782832jdnsh6a938jfnc37\12334567.XML
aqFile.Copy( Project.Variables.FilePath+"\*\\\\"+"*.XML","C:\\ myfolder\\New.XML",true); doesnot work.
eg my application generate xml file.
It is placed in spool directory and sub derectory with random name
like C:\Spool\782832jdnsh6a938jfnc37\12334567.XML
aqFile.Copy( Project.Variables.FilePath+"\*\\\\"+"*.XML","C:\\ myfolder\\New.XML",true); doesnot work.
- 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");
}