Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 284 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File size obtained from Script is not the same as "Get Info" in Finder

#1
Edit: I found more context on this problem and asked another question

[To see links please register here]


I am creating a Swift script to calculate the size of a bunch of frameworks in my app. It seems to work, but the sizes don't add up.

In finder on a specific framework, `Get Info` shows 6,801 KB

In my script, I'm using this code to get the file sizes (with different keys):

var bool: ObjCBool = false
if FileManager.default.fileExists(atPath: documentsDirectoryURL.path, isDirectory: &bool), bool.boolValue {
var folderSize = 0
FileManager.default.enumerator(at: documentsDirectoryURL, includingPropertiesForKeys: [.<key_here>], options: [])?.forEach {
folderSize += (try? ($0 as? URL)?.resourceValues(forKeys: [.<key_here>]))??.<key_here> ?? 0
}

return Int64(folderSize)
}

I get 4,133 KB with `fileAllocatedSizeKey` & `totalFileAllocatedSizeKey`

I get 4,126 KB with `fileSizeKey` & `totalFileSizeKey`

According to the [docs][1], the difference between these 4 keys has to do with metadata and the size vs allocated size. If I'm getting allocated size, why is there still 2-3 MB missing between these sizes?

PS: In this example the Finder version was bigger, but in many others the size calculated in the script is larger than the size from Finder.

I don't know what to trust!

[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through