开发者

How to get folder size in Adobe Air?

How to get folder开发者_如何学C size in Adobe Air?


Should be fairly simple using File.size. Just in case is confusing, folders in AIR are represented using the File class, which extends FileReference, thus the link to the FileReference documentation.


Recursive folder listings and contents processing
http://cookbooks.adobe.com/post_Recursive_folder_listings_and_contents_processing-9410.html

...has sufficient sample code in it to get you started.


my implementation is:

public static function getFileSize(file:File):Number{ var result:Number = 0; if(file == null || file.exists == false) { return 0; } if(file.isDirectory){ var files:Array = file.getDirectoryListing(); for each (var f:File in files) { if(f.isDirectory){ result += getFileSize(f); }else{ result += f.size; } } }else{ return file.size; } return result; }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜