Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:02:39+00:00 2026-06-09T16:02:39+00:00

I am writing a utility that walks a directory tree on Mac OS X

  • 0

I am writing a utility that walks a directory tree on Mac OS X (10.6 and higher) and tries to detect changes that have occurred since the directory was last synchronized with a back-up location.

When I initially synchronize the files and folders I obtain the inode number and store it in the database record for that file or folder:

NSString *oldFilePath = /* ... */;
NSError *error = nil;
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:oldFilePath error:&error];
/* set database record for oldFilePath to [attributes fileSystemFileNumber] */

When I encounter a new file or folder I first do a database lookup using the inode number to find the original file, if any.

But in the case where a file has moved from a parent directory to a sub-directory, and I am trying to detect changes to the parent directory I would like to be able to use the saved inode number to identify the new path so that I can distinguish between a move and a delete.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:02:41+00:00Added an answer on June 9, 2026 at 4:02 pm

    inode numbers are only unique within a filesystem, so you need at least device and inode number to identify a file.

    On the HFS+ file system, the inode number is in fact identical to the “Macintosh File Id”, and there is a special “/.vol” filesystem that allows you to find a directory by device and inode.

    Example:

    $ cd /.vol/234881029/342711
    $ pwd
    /Volumes/Data/tmpwork/test20/test20.xcodeproj
    $ stat .
    234881029 342711 drwxr-xr-x 5 martin staff 0 170 ......
    

    As you can see, 234881029 is the device number of “/Volumes/Data”, 342711 is the inode number of “tmpwork/test20/test20.xcodeproj” within that filesystem, and

    cd /.vol/<deviceNo>/<inodeNo>
    

    transferred you directly to that folder. You could now use getcwd() to determine the real path to that folder.

    The “/.vol” filesystem is documented in the legacy Technical Q&A QA1113.

    Disclaimer: I tried this only on OS X 10.7 and I am fairly sure that it works on older systems. I have no idea if you can rely on this feature in future versions of OS X. Also it is very HFS specific.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a utility that changes the directory where the Mac OS X
I have a rather simple threading question. I'm writing a simple utility that will
I am writing a utility that would allow me to monitor the health of
I am writing a simple DOS utility that uses the findstr utility to search
I'm writing a unit test for a Text Scrubber utility that will remove any
EDIT: To explain my motivation for this, I'm writing a command-line utility that takes
I'm writing a utility program with C# in WPF that allows users to create
As the title reveals it, we are writing a Unix-style shell utility U that
I am writing a dll with a number of high-level utility classes, that other
I'm writing a utility that takes in a .resx file and creates a javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.