Renaming a File with Perl's RENAME Function
To rename the file city.txt to citynames.txt
rename("city.txt", "citynames.txt");
You can move the file as well by specifying the path, but BE CAREFUL. A file with the same name where you are moving to, will be overwritten.
rename("city.txt", "citydata/citynames.txt");
The above would move city.txt to directory citydata as it renamed to citynames.txt
Copy and Paste Perl Code:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
rename("city.txt", "citynames.txt") || print "Don't have permission to rename.<br><br>";
print "Done";
exit;
Rename Perl Function - Test
Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
| | | CSS David McFarland |
| | | |
| | | |