Re: Script to run on web server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mysterons Web Design wrote:

Hi,
I need to run a script (that I can run via cron) to rename a file from its existing name to its new name - but I dont have a clue how to do it - can anyone help?
basically I have a file called index.new that I want to become index.html
Thanks in advance!
Joe

Got Perl?


#!/usr/bin/perl

$path = /path/to/file;
$exist_file = "index.new";
$new_file = "index.html";
if ( ! rename "$path/$exist_file", "$path/$new_file" ) {
	// Do what needs to be done for an error

}

My Perl's a bit rusty, but I think this will do what you're asking for.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com


-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux