Subject: | wrong behavior when copying to '.' |
When I do the following:
rcopy( '/somedir/foo', '.' )
I expect the foo file to be copied to my current working directory, mode
intact and everything. However:
1) if I'm copying an executable, the executable mode seems to disappear
2) if I'm copying a directory, rather than the directory being copied, the
contents of the directory are copied instead
For example, I assume I have the following:
/somedir/foo/file1
/somedir/foo/file2
and I'm in /home/ofer, and I run a script with:
rcopy( '/somedir/foo', '.' );
what I expect to end up with is:
/home/ofer/foo/file1
/home/ofer/foo/file2
what I get instead is
/home/ofer/file1
/home/ofer/file2
Both of these bugs can be avoided by explicitly stating the target name:
rcopy( '/somedir/foo', 'foo' );
But often it's convenient to just say '.', as in copy it to my local dir.
Sometimes you just have a path, and don't want to take the time to parse
out the filename so you can pass it as the second arg.