6 Replies
      Latest reply: Nov 23, 2016 11:33 PM by linkuanlu RSS
      linkuanlu Level 1 Level 1 (0 points)

        I want to be able to extract SMB to serve folder's server path ,Like this

        smb://10.248.120.50/TE-SW

        • Re: How get SMB folder attribute's server path information?
          eskimo Apple Staff Apple Staff (6,765 points)

          What platform are you targeting?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: How get SMB folder attribute's server path information?
              linkuanlu Level 1 Level 1 (0 points)

              Thanks for your answer! My platform is MAC OS X and Programming language is Objective-C.

              I want to use the code to obtain in the smb shared folder's general information server path (eg:   smb: /10.248.120.50 /TE-SW).

                • Re: How get SMB folder attribute's server path information?
                  eskimo Apple Staff Apple Staff (6,765 points)

                  My platform is MAC OS X …

                  OK, that’s a good start.

                  I want to use the code to obtain in the smb shared folder's general information server path (eg: smb://10.248.120.50/TE-SW).

                  I’m still not sure I understand your requirements.  From the above it seems that you have a mounted SMB volume and you want to get the URL that was used to mount it.  Is that right?

                  If so, you can get this via the NSURLVolumeURLForRemountingKey URL resource value.

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: How get SMB folder attribute's server path information?
                      linkuanlu Level 1 Level 1 (0 points)

                      Yes, my demand is so, but I used the mountedVolumeURLsIncludingResourceValuesForKeys    method than can't  obtain the wish result, I will attempt your recommendation,Thanks!

                        • Re: How get SMB folder attribute's server path information?
                          linkuanlu Level 1 Level 1 (0 points)

                          NSURL *url=[NSURL  fileURLWithPath:@"/Volumes/TE-SW" isDirectory:YES];

                          NSLog(@"%@",[url resourceValuesForKeys:[NSArray arrayWithObjects: NSURLVolumeAvailableCapacityKey,NSURLVolumeCreationDateKey,NSURLVolumeIsAutomountedKey,NSURLVolumeIsBrowsableKey,NSURLVolumeIsEjectableKey,NSURLVolumeIsInternalKey,NSURLVolumeIsJournalingKey,NSURLVolumeIsLocalKey,NSURLVolumeIsReadOnlyKey,NSURLVolumeIsRemovableKey,NSURLVolumeLocalizedFormatDescriptionKey,NSURLVolumeLocalizedNameKey,NSURLVolumeMaximumFileSizeKey,NSURLVolumeNameKey,NSURLVolumeResourceCountKey,NSURLVolumeSupportsAdvisoryFileLockingKey,NSURLVolumeSupportsCasePreservedNamesKey,NSURLVolumeSupportsCaseSensitiveNamesKey,NSURLVolumeSupportsExtendedSecurityKey,NSURLVolumeSupportsHardLinksKey,NSURLVolumeSupportsJournalingKey,NSURLVolumeSupportsPersistentIDsKey,NSURLVolumeSupportsRenamingKey,NSURLVolumeSupportsRootDirectoryDatesKey,NSURLVolumeSupportsSparseFilesKey,NSURLVolumeSupportsSymbolicLinksKey,NSURLVolumeSupportsVolumeSizesKey,NSURLVolumeSupportsZeroRunsKey,NSURLVolumeTotalCapacityKey,NSURLVolumeURLForRemountingKey,nil] error:nil]);

                          Result:

                          2016-11-24 15:16:02.620 smb[1983:95887] {

                              NSURLVolumeAvailableCapacityKey = 206003412992;

                              NSURLVolumeCreationDateKey = "2015-10-30 05:50:02 +0000";

                              NSURLVolumeIsAutomountedKey = 0;

                              NSURLVolumeIsBrowsableKey = 1;

                              NSURLVolumeIsEjectableKey = 0;

                              NSURLVolumeIsJournalingKey = 0;

                              NSURLVolumeIsLocalKey = 0;

                              NSURLVolumeIsReadOnlyKey = 0;

                              NSURLVolumeIsRemovableKey = 0;

                              NSURLVolumeLocalizedFormatDescriptionKey = "SMB (NTFS)";

                              NSURLVolumeLocalizedNameKey = "TE-SW";

                              NSURLVolumeMaximumFileSizeKey = 9223372036854775807;

                              NSURLVolumeNameKey = "TE-SW";

                              NSURLVolumeResourceCountKey = 0;

                              NSURLVolumeSupportsAdvisoryFileLockingKey = 1;

                              NSURLVolumeSupportsCasePreservedNamesKey = 1;

                              NSURLVolumeSupportsCaseSensitiveNamesKey = 0;

                              NSURLVolumeSupportsExtendedSecurityKey = 0;

                              NSURLVolumeSupportsHardLinksKey = 0;

                              NSURLVolumeSupportsJournalingKey = 0;

                              NSURLVolumeSupportsPersistentIDsKey = 0;

                              NSURLVolumeSupportsRenamingKey = 0;

                              NSURLVolumeSupportsRootDirectoryDatesKey = 1;

                              NSURLVolumeSupportsSparseFilesKey = 1;

                              NSURLVolumeSupportsSymbolicLinksKey = 1;

                              NSURLVolumeSupportsVolumeSizesKey = 1;

                              NSURLVolumeSupportsZeroRunsKey = 0;

                              NSURLVolumeTotalCapacityKey = 214748364800;

                              NSURLVolumeURLForRemountingKey = "smb://F3417320@10.248.120.50/TE-SW";

                          }

                        • Re: How get SMB folder attribute's server path information?
                          linkuanlu Level 1 Level 1 (0 points)

                          Already basically obtained the result which I want, only needs to make the small modification. Thanks!