SunQuest
           FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

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:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old November 19th, 2003, 08:25 AM
elmic elmic is offline
Code Monkey
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Fort Myers, FL
Posts: 24 elmic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 27 sec
Reputation Power: 0
FTP File Check

I have a database of about 3000 files. On a diffrent server I have the corsoponding files aviaiable via FTP. Recently I discover one of the people that was helping me was entering file names into the database but not putting the files on the FTP server so that users are getting broken links.

I thought I could use LWP to confirm each file. I can certainly download each file as a way to confirm it but this is time and bandwidth consuming.

Is there a way with LWP to have it simple respond weather the file exists or not? Been looking through docs but I'm not seeing it and it seems like such a basic feature I can't believe that it's not there.

Reply With Quote
  #2  
Old November 19th, 2003, 08:41 AM
webmasta's Avatar
webmasta webmasta is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Aug 2003
Location: Toronto
Posts: 1,614 webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 m 38 sec
Reputation Power: 7
There is, and you dont need LWP for that... just use the -e switch to test for existence. You can then print the results to the screen.

Loop through your array of filenames:

print "$filename not found" unless (-e "$filename");
__________________
webM

for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};

Reply With Quote
  #3  
Old November 19th, 2003, 08:55 AM
ishnid's Avatar
ishnid ishnid is offline
kill 9, $$;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Sep 2001
Location: Dublin, Eire
Posts: 5,506 ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level)ishnid User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 16 h 9 m 55 sec
Reputation Power: 1322
I usually use Net::FTP for this sort of thing, which has two functions that might help.

size($filename) returns (obviously) the size of the file. If the file doesn't exist, it returns undef.
Code:
foreach (@filenames) {
   print "$_ not there\n" unless (defined $ftp->size($_));
}


Alternatively, if all the files you're interested in are in the same directory, get a directory listing and process that. This is probably quicker as it reduces the number of transactions with the FTP server.
Code:
my @files_on_server = $ftp->ls();

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > FTP File Check


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 3 hosted by Hostway