Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 4th, 2000, 10:34 AM
nilch nilch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Calcutta, West Bengal, India
Posts: 25 nilch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I want to write a small program in perl that will check a particular directory in the Linux filesystem and copy a file (if it exists) and transfer to another directory over the network.

This perl program should be checking the directory every 5 minutes (or xx minutes). Should I CRON this program ?

Please help, I will be very pleased since I am new to this Perl world and got to get this solved.

Thanks in advance

Reply With Quote
  #2  
Old December 4th, 2000, 12:35 PM
tron's Avatar
tron tron is offline
SwollenMember
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: the master control
Posts: 234 tron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 46 sec
Reputation Power: 9
yes, use a cron command.

Reply With Quote
  #3  
Old December 4th, 2000, 02:14 PM
nilch nilch is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Calcutta, West Bengal, India
Posts: 25 nilch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the help on the CRON part. I also need help on the Perl program part to chek the directory and either copy or FTP to another directory aor FTP directory

Thanks in advance.

Reply With Quote
  #4  
Old December 4th, 2000, 04:42 PM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I'm not sure what you wish to do, but if you wish to see ifa file exists, and then copy it to another directory, simply use this:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
if (-e $somefile){
system("cp $somefile $destionation");
}
[/code]

If you want to copy this file to another FTP server, use the Net:FTP module, available from CPAN...


Reply With Quote
  #5  
Old December 6th, 2000, 03:39 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
The BEST way, however, is to use "rsync" -> ftp://sunsite.auc.dk/pub/unix/rsync/ which should do exactly what you wanted efficiently.
It's highly customizable, you can even ignore certain files, keeping original timestamp and permission and so.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Filesystem program in Perl - howto


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway