Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: renaming a file and moving into another folder

by Marshall (Canon)
on Sep 21, 2011 at 18:40 UTC ( [id://927199]=note: print w/replies, xml ) Need Help??


in reply to Re: renaming a file and moving into another folder
in thread renaming a file and moving into another folder

But all the schoolbooks show the hard drive to be a big file cabinet, with multiple drawers, labeled A- Z. Did my teachers lie to me ? :-)
No. I wouldn't say that they "lied". I would say that they simplified things at the beginning and you may have missed the reality checkpoints later in the curricula. Please do not get offended. This misconception is common. In Unix you should look at the link count associated with a file.

Basically I am saying that the file system directory associates a text name with essentially a starting byte number on the hard drive. There can be more than one text name associated with the same byte number on the hard drive. These are called "hard links".

So, I would say that it is a pretty good approximation to say that the hard disk gets divided up into blocks. A file is just a name in the directory that points to a sequence of these blocks. More than one file name can point to the same sequence of blocks. These blocks on the hard drive are not reused until the reference count to them drops to zero (this just like Perl reference counting).

So, a more accurate description would be that there are file cabinets with drawers, folders and documents. You have a spiral bound book that associates a "text name" and a file/folder in cabinet1, drawer2, folder3,document5. There may be more than one name in your spiral bound book that points to exactly the same place! Your spiral bound book is what a directory entry is.

  • Comment on Re^2: renaming a file and moving into another folder

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://927199]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-05-20 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found