Anonymous user
Rename a file: Difference between revisions
→{{header|Perl}}: also core rename()
(→{{header|Perl}}: also core rename()) |
|||
Line 627:
move (catfile rootdir, 'input.txt'), (catfile rootdir, 'output.txt');
move (catfile rootdir, 'docs'), (catfile rootdir, 'mydocs');</lang>
The core <code>rename($oldfile,$newfile)</code> can rename a file within a directory, but has the usual limitations of the <code>rename()</code> system call or C library function, which means generally not working across filesystems, and perhaps not working to rename directories. <code>move()</code> does a copy and delete when necessary.
=={{header|Perl 6}}==
<lang perl6>rename 'input.txt', 'output.txt';
|