CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2007
    Posts
    62

    [RESOLVED] Underlying mechanism of renaming file / folder

    Hi,

    When I rename a file / folder, the renaming process seems to be independent of the size of the file / folder. Therefore it is clear that this renaming process does not involve the creation of a copy with the altered name and the deletion of the original file / folder.

    Therefore what actually happens?

    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Underlying mechanism of renaming file / folder

    A typical file system stores meta-data on disk for each file, directory, etc. Renaming a file is then just a matter of re-writing the bytes on disk that store the name.

    gg

  3. #3
    Join Date
    Sep 2007
    Posts
    62

    Re: Underlying mechanism of renaming file / folder

    Hi, does this mechanism have a particular name, which I can type into a search engine to find out more info? Thanks.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Underlying mechanism of renaming file / folder

    No, but you could search on a particular file system to learn how it works in more detail. FAT is fairly simply.

    gg

  5. #5
    Join Date
    Sep 2007
    Posts
    62

    Re: Underlying mechanism of renaming file / folder

    Thanks. Following your suggestion I did a search and found that the NTFS article in wikipedia contains useful information :

    "The Master File Table (MFT) contains metadata about every file, directory, and metafile on an NTFS volume. It includes filenames, locations, size, and permissions. Its structure supports algorithms which minimize disk fragmentation."

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Underlying mechanism of renaming file / folder

    from the old DOS days. FAT16 was the File Allocation Table structure of 16 bit words that allowed access to 'huge' hard drives. There were 2 copies on each drive.

    deleting a file just meant changing name.txt to ~ame.txt, and Norton Undelete gave you a list, allowing you to replace the ~, to recover the file name
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured