Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl script for copying and renaming files

Status
Not open for further replies.

maunir

MIS
Apr 30, 2002
62
US
Has anyone written a script in Perl for doing copy and renaming files...?
here's the scenario...
1) We have a mountpoint (/tmp/foo) in Solaris 9 (Server A) where a file gets created and this same mount point exist on Server B as a nfs "ro" mountpoint (/tmp/foo) . The script run every 30 minutes on Server B and checks for any new files that were created on mountpoint foo.
2) Scripts find that new files were created and checks for any existing files on mountpoint (/tmp/bar) on Server B. If the file exists, then it renames the existing file with the timestamp at the end of the file. If the files doesn't exist it just simply copies it on /tmp/bar. None of the files should ever be deleted from anywhere.

I'm sorry that I'm asking for help in such a manner, but I'm out of time and this was just given to me about 2 days ago. To make matter worse I'm not that savvy with perl and there is no way I could come up with it by the end of this week.

thanks
 
use File::Copy;

Or you could call system commands from within Perl:

Code:
# call the cp command
`cp /tmp/foo/$file /tmp/bar/$file`;

-------------
Cuvou.com | The NEW Kirsle.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top