Re: Deleting files



Anders F wrote:

Is there a Perl subroutine for deleting files?

There's a builtin. It's called "unlink".

http://perldoc.perl.org/functions/unlink.html

The reason for the odd name is because on Unix, there's no garantee that
if you succesfully apply this function on a file, that it will indeed be
deleted. There' something called a "hard link", so there can be multiple
directory entries, possibly in more than one directory, for the same
file. "unlink" will remove one such directory entry (called a "link").

Only when all links are gone, will the file contents indeed be deleted.

--
Bart.
.



Relevant Pages

  • Re: Deleting files
    ... The reason for the odd name is because on Unix, there's no garantee that ... There' something called a "hard link", ...
    (comp.lang.perl.misc)
  • Re: [SLE] preserving files creation time
    ... I'm not sure if I can provide the answer directly, but a Linux (and Unix) ... create an additional hard link to a file, ctime will change. ... This is a hard link to the current directory. ...
    (SuSE)
  • Re: Hard link
    ... Ok if the date in secret.txt was "My name is Michael" the same data wan in ... Or create a hard link with Unix, ... Dos and ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: symbolic links and remote machines
    ... A hard link *is* a directory entry. ... Both hardlink /and/ softlink (aka symlink) are directory entries. ... you /might/ want to check out my Linux Gazette article on hard links ...
    (comp.os.linux.misc)
  • Re: Ada.Directories
    ... On a Unix system it _is_ a hard link. ... the interface contract (AFAIK even described in various standards). ...
    (comp.lang.ada)