File Attributes

See the names of all the directories and files that the app is allowed to read and/or write in the iPhone.

Source code in Attributes.zip

  1. AppDelegate.swift

Output when running on iOS Simulator

home directory = /Users/myname/Library/Developer/CoreSimulator/Devices/01EBED35-F21B-4B4C-95BC-BFDDDC6264B4/data/Containers/Data/Application/F0D80720-A6EB-4DF7-86CD-5AF224354657

NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780439
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 189
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 420
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeRegular
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 1
NSFileModificationDate: 2015-01-15 20:36:08 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780434
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 68
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 2
NSFileModificationDate: 2015-01-15 20:36:08 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780435
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 136
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 4
NSFileModificationDate: 2015-01-15 20:36:08 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780436
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 102
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 3
NSFileModificationDate: 2015-01-15 20:36:19 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780530
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 102
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:19 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 3
NSFileModificationDate: 2015-01-15 20:36:19 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780531
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 170
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:19 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 5
NSFileModificationDate: 2015-01-15 20:37:16 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780532
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 102
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:19 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 3
NSFileModificationDate: 2015-01-15 20:36:19 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780533
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 36864
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 420
NSFileCreationDate: 2015-01-15 20:36:19 +0000
NSFileType: NSFileTypeRegular
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 1
NSFileModificationDate: 2015-01-15 20:37:17 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780642
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 37993
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 420
NSFileCreationDate: 2015-01-15 20:37:16 +0000
NSFileType: NSFileTypeRegular
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 1
NSFileModificationDate: 2015-01-15 20:38:18 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780641
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 36864
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 420
NSFileCreationDate: 2015-01-15 20:37:15 +0000
NSFileType: NSFileTypeRegular
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 1
NSFileModificationDate: 2015-01-15 20:38:18 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780437
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 68
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 2
NSFileModificationDate: 2015-01-15 20:36:08 +0000
--------------------------------
NSFileOwnerAccountID: 502
NSFileSystemFileNumber: 34780438
NSFileExtensionHidden: 0
NSFileSystemNumber: 16777218
NSFileSize: 68
NSFileGroupOwnerAccountID: 20
NSFilePosixPermissions: 493
NSFileCreationDate: 2015-01-15 20:36:08 +0000
NSFileType: NSFileTypeDirectory
NSFileGroupOwnerAccountName: staff
NSFileReferenceCount: 2
NSFileModificationDate: 2015-01-15 20:36:08 +0000
--------------------------------

Things to try

  1. To see the familiar Unix permission bits of each directory and file, run bc (the binary calculator) in Terminal.app to convert the NSFilePosixPermissions from decimal to octal. For example, decimal 493 = octal 755 and means rwxr-xr-x.

    bc
    obase=8
    493
    755
    control-d
    

    To see the permission bits in octal, change the loop that prints the attributes to the following. %lo stands for “long octal”.

    					for (key, value) in attributes! {
    						if key == "NSFilePosixPermissions" {
    							let permissions: Int = value as Int;
    							let octal: String = String(format: "%03o", permissions);
    						} else {
    							print("\(key): \(value)");
    						}
    					}
    
    NSFilePosixPermissions: 644