android 获取文件夹.文件的大小 以B.KB.MB.GB 为单位 public class FileSizeUtil { public static final int SIZETYPE_B = 1;//获取文件大小单位为B的double值 public static final int SIZETYPE_KB = 2;//获取文件大小单位为KB的double值 public static final int SIZETYPE_MB = 3;//获取文件大小单位为MB的double值
源:获取文件的大小(实际&物理) class function TDuoFile.GetFileSize(const AFile: TFileName): Int64; var sr:TSearchRec; begin then Result := sr.Size else Result := ; FindClose(sr); // Windows.GetFileSizeEx() // 这个函数是新API // 另一种写法 //var hh:THandle;dwSizeLow,dwSizeHig
//字节大小,K,M,G public static final long KB = 1024; public static final long MB = KB * 1024; public static final long GB = MB * 1024; /** * 文件字节大小显示成M,G和K * @param size * @return */ public static String displayFileSize(long size) { if (size >= GB) { ret
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FileList { public class Program { public static void Main(string[] args) { Console.WriteLine(); long length
__author__ = 'bruce' import os from os.path import join,getsize def getdirsize(dir): size=0l for (root,dirs,files) in os.walk(dir): for name in files: try: #print getsize(join(root,name)) size += getsize(join(root,name)) except: continue #直接用下面这句代码,在