Flex, AIR: Search .pdf files in specified folder

I need an ActionScriot code that will parse the given folder and search for .txt files. Any links or code samples would be helpful. (Adobe Flex 3.3 / AIR)

Thanks Shri

+2


source to share


1 answer


There:



var docs:File = File.documentsDirectory;
var dirs:Array = docs.getDirectoryListing();
var pdfFiles:String = "";
for(var i:int; i < dirs.length; i++)
{
    var f:File = dirs[i] as File;
    if(f.isDirectory || f.name.toLowerCase().lastIndexOf(".pdf") != f.name.length - 4)
        continue;

    pdfFiles += f.name + "\n";
}
txt.text = pdfFiles;

      

+6


source







All Articles