|Just another Perl shrine|
I just learned I can use unlink to delete files. Surprisingly I couldn't find how to do other fundamental file actions,
such as copy cu and paste without using any modules.
I did found other function which got he work "link" in them,
but the description of these function in perldoc is very unclear (at least for me),
(example: "link - Creates a new filename linked to the old filename", is that means: a copy ? a shortcut ? my interpretation: a shortcut that the system consider a regular file ???)
and I wouldn't try to use this type of functions until I'm absolutely sure what they do,
especially after reading the description for "rename" that supposedly is a lot less predictable than expected.
As requested by Marshall I'll further specify my intentions.
1st of all I am familiar with he inner mechanics of file handling (I've done some Assembler a decade ago),
but I've never heard about any modern operating system (I'm a windows user), that would allow multiple references to he same file without calling all but one "shortcuts".
Although it is of course technically possible.
my (well, windows's really) definitions: (sorry for the over specifying..)
* Applying cut & paste on a file, is (as far as the common non-programmer user concerns) moving it from 1 directory to another, so it exists in the new directory, but no longer exists in the old one.
* Applying copy & paste on a file, is (as far as the common non-programmer user concerns), copying it from 1 directory to other(s), so it exists in all the new directories and the old 1.
In his case the files may be (at the time of copy) identical (except for their paths ^^), but they are completely independent of each other,
so 1 (or more) may be renamed/edited/deleted/anything without affecting the others in any way.
* Applying "delete" on a file, is (as far as the common non-programmer user concerns), removing the file from existence so it can not be accessed in any way ever again.
* a shortcut, is a file that only contains one thing: a single path to a non-shortcut file.
a shortcut is referring only to the file itself by path, and so it's use is completely dependent on the file it is targeting.
if the file targeted is edited, the change will be noticeable when accessing the file through it's shortcut just as it would be when accessing it directly.
if the target file is renamed/moved/deleted the shortcut would (when accessed) be unable to find it's file target and will become useless.
In reply to How to copy/cut and paste files without using modules ? by palkia