Re: can you improve this text-only beginner copy program?

Grant Edwards via Python-list <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
On 2025-08-28, Roel Schroeven <[email protected]> wrote:

>> If an OS did let you delete an open file, how would you expect it to 
>> behave? Would you still be able to use the file? Would the file be 
>> marked for deletion and be deleted when it was finally closed?

> Unix-like operating systems do let you delete an open file. It then 
> disappears from directory listings,

To clarify: it only disappears from the one directory from which you
deleted it.  Removing a file that exists in multiple directories will
not cause it to disappear from any of the other directories.

> but is not actually deleted until the last process that has an open
> handle to the file closes that handle (or exits, in which case the
> handle is closed automatically).

Right. On Linux/Unix the 'rm' operation merely removes the link from
the directory to the inode. The underlying filesystem won't 'delete'
the actual file (inode and associated storage blocks) unless that was
the only link to the inode and there are no open file handles
associated with the inode. When the total number of links/handles
drops to zero, then the filesystem will 'delete' the file.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.