Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Update: I see that this post has gotten a down vote for no apparent reason from the voter (no reply to my post).
That is unfortunate.
If that happened because my tone may offend the OP, it was not my intent at all to offend the OP.
I see the problem of not understanding the idea of "text of filename"->(pointer) to data often with Windows students.
If there is a way to explain it better than I did, then great! Please post!

---original post continues---

Deleted perhaps inflammatory statement.

Your question demonstrates a fundamental lack of understanding of how a file system works.A file does not "exist in a directory" - NO! - that is not what happens!

As a simplification, lets say that a file is just a "block of contiguous bits/bytes on the disk". The disk is a huge block of contiguous bytes from say byte 0 to byte 2,000,000,000. A file may exist from byte 10356 to byte 22356 on the disk.

The directory entry for "c:\ksk\vista\sra.txt" would be a data structure with an association between that text name and a pointer to say byte 10356 as the "start" and this text name would also have a length of 22356-10356+1 bytes associated with it. There would be other properties associated with that text name - this is called a "directory entry" - like the telephone "white pages": name, address, etc.

So if we "rename" sra.txt to SRA_new.txt:
That means that this directory entry text name that associates "c:\ksk\vista\sra.txt" to byte 10356 on the disk changes to "c:\ksk\vista\SRA_new.txt". No data on the disk moves.

If we want to "move" the file to a different directory on the same physical disk drive/file system, no bits in the file are actually "moved"!! NO!! We just create a new entry: "C:\home\sra.txt" to point to byte 10356 and delete the entry for "c:\ksk\vista\sra.txt".
So "moving a file to a different directory on the same disk" is the same as "renaming it"!

Moving a file from one physical disk to another is different. We have to create a directory entry on the other disk, copy the bits from disk1 to disk2, delete the directory entry on disk1, etc.

I am sorry that I got long winded here. But there is NO difference in what happens to the bits on the disk between "changing the name associated with those bits" and "moving those bits to a different directory" - this is just changing the text name associated with the starting byte of the data.

In reply to Re: renaming a file and moving into another folder by Marshall
in thread renaming a file and moving into another folder by sravan008

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-05-18 23:20 GMT
Find Nodes?
    Voting Booth?

    No recent polls found