Perl FTP - check file size


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl FTP - check file size
# 1  
Old 02-16-2007
Perl FTP - check file size

The FTP perl module does not have any function which checks if the file downloaded is of size 0. Is there any way in perl to check while getting the files through FTP?

Sometimes, there might be a problem with FTP and the downloaded file maybe of size 0. Hence, I would like to FTP that file again. That's why I want to check the file size so that I know if the FTP has succeeded.

Thanks,
Rahul.

Last edited by rahulrathod; 02-16-2007 at 08:24 AM..
# 2  
Old 02-20-2007
check the size() method of Net::FTP module

if this is not what you want, you will have to use the -z or -s file test operators

operator = Meaning
-z = File has zero size
-s = File has nonzero size (returns size)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File size check

I am trying to check whether two files are empty or not using below if condition but its checking for only one file if ] Again I tried if && ] Need your assistance (2 Replies)
Discussion started by: Aditya_001
2 Replies

2. Shell Programming and Scripting

Unable to get the size of remote file using Net::FTP Perl Script

Hi, I am using below piece of code to get the size of the remote file. $ftp->cwd($destination) or $error=$ftp->message; if(!$error) { $ftp->put($file) or $error=$ftp->message; print "FTP size = \n"; ... (3 Replies)
Discussion started by: FarooqOnline
3 Replies

3. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

4. Shell Programming and Scripting

Perl Script to check file date and size

Hi guys, i am new to perl. I started reading the perl documents and try to come up with some logic. I am trying to create a script that would go into a location, search for todays files, then searches for all .txt files from today. If todays not found, its an error If file size is less... (26 Replies)
Discussion started by: DallasT
26 Replies

5. Shell Programming and Scripting

FTP Perl Script File Size Mismatch.

Hello, I've written a Perl script that copies a set of files from one server to another. Prior to transferring a file the script gets the file size from the source system and compares this to the file size received in the target system. Except that the file sizes are slightly different. ... (1 Reply)
Discussion started by: mbb
1 Replies

6. Shell Programming and Scripting

Check for file size is zero or not.

I have following script on AIX/KSH if ] ; then echo "filename exists and is > 0 bytes" else echo "filename does not exist or is zero length" fi It is not working. What is wrong here??? (3 Replies)
Discussion started by: Hangman2
3 Replies

7. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

8. Shell Programming and Scripting

How to check file size before and after FTP

I want to trasfer file from 1. Unix server A to server B 2. Unix server A to windows directory Is there a way to check the size before and after FTP. I want to check the size of the file in server A before FTP and in server B after FTP in case 1 In case 2 I want to check the size of... (1 Reply)
Discussion started by: i.scientist
1 Replies

9. Shell Programming and Scripting

file size check

How can I perform size check of any character file(which switch)? For example: I have to perform certain actions if file size is not zero. How can I do that? Is this syntax fine? if test ! -z $filename then fi (2 Replies)
Discussion started by: malaymaru
2 Replies

10. Shell Programming and Scripting

perl ftp check file exists

I have a perl script that ftp's to an NT server, checks if the file is growing, gets the file, does some more size checking after the get on the unix box. My question, is there a good way to check if the file exists on the NT when I know the exact file to check for? I thought about doing an "ls... (2 Replies)
Discussion started by: methos
2 Replies
Login or Register to Ask a Question