1 read the size of the folder in the local documents file (we can use the Nsdirectoryenumerator class)
NSString * Docupath = Nssearchpathfordirectoriesindomains(nsdocumentdirectory, Nsuserdomainmask, YES) [0];
not normally. Files are placed directly under the Documents folder to create a new folder
NSString * FilePath = [Docupath stringbyappendingpathcomponent:@ "DownLoadFile"];
Nsdirectoryenumerator * enumerator = [[Nsfilemanager Defaultmanager] enumeratoratpath: FilePath];
A long long size = 0;
While ([enumerator nextobject])
{
nsdictionary * dic = [enumerator fileattributes];
Size + = [dic fileSize];
}
2. Get the properties of a folder using
[[Nsfilemanager Defaultmanager] attributesofitematpath:[filepath] error:nil];
It can only query the folder's properties to not calculate the size of the folder
3. Calculate the size of the file download
Nsdictionary * info = [[Nsfilemanager Defaultmanager] attributesofitematpath:p ath error:Nil ];
long long size = [info fileSize];
4. Delete local ask and delete from cell
Pub_file * p = self . Receivearry[indexpath. Row];
Delete from local
[[Nsfilemanager Defaultmanager] removeitematpath: [filedownload creatpath:p. Name] Error:nil];
Remove from Table
[self. Receivearry removeobjectatindex: Indexpath.row];
[_tableview deleterowsatindexpaths:@[indexpath] withrowanimation: Uitableviewrowanimationautomatic];
Remove the file from the local technology directly by using the File Manager directly delete,,,,,,,, Delete the contents of the cell must first delete the contents of the source array, and then delete the corresponding cell of this content, or it will cause the program to crash
Calculation of file size and calculation of folder size