On Fri, 23 Aug 2019 19:13:15 +0100
Mike Martin <redt...@gmail.com> wrote:

> Am I right in believing that remove_tree from File::Path does not
> follow symlinks, ie: does not remove the linked file only the link if
> there are links in the direstories removed

An obvious way to find out would be to just try it - set up two test
directories with files, add a symlink in the first to a file in the
second, then run remove_tree on the first and see what happens :)

Otherwise, File::Path uses unlink() to remove the files, the doco for
which is at https://perldoc.perl.org/functions/unlink.html

That isn't massively detailed, but the manpage for unlink(2) gives much
more detail: https://linux.die.net/man/2/unlink

-- start quote --
unlink() deletes a name from the file system. If that name was the
last link to a file and no processes have the file open the file is
deleted and the space it was using is made available for reuse.

If the name was the last link to a file but any processes still have
the file open the file will remain in existence until the last file
descriptor referring to it is closed.

If the name referred to a symbolic link the link is removed. 
-- end quote --


So, if there's a symlink, you can expect the symlink to be removed, but
the file it linked to to be untouched.  Even if it's a hard link, the
file will still exist unless the other link to it gets removed.

Cheers

Dave P (BIGPRESH)

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to