Avatar

Employee Advisor

If you are running Linux you can use the following script, you need to make sure you have the correct folder path

 

/* Define server folder path examples:
	/usr/local/neolane/nl6/var/<instance_name>
	/usr/local/neolane/nl6/var/res/<instance_name>
	/usr/local/neolane/nl6/var/<instance_name>/export/
*/

var strFolderPath = "/usr/local/neolane/nl6/var/res/";
var strPattern = "*.txt";
var objDirectory = new File(strFolderPath);
var objFiles = objDirectory.list(strPattern);
logInfo("No. of files that match search criteria are : " + objFiles.length); 


for each(var objFile in objFiles)
{
  logInfo(objFile.name);
  objFile.remove();
}

/* File patterns examples:

	"*.*" : all files.
	"*.txt" : all text files.
	"A*.*" : all files whose name start with A
	"A*z.*" : all files whose name start with A and ends with Z.

*/

 Someone wrote a nice guide here also : https://bit.ly/2WNOor4