Checking the size of a file after FTP

Hi
I am doing a FTP process through which I am copying a file from my local server to Remote server. After this I want to check the size of the file

Below is my program:

LOCALDIR=/batch/ediprocess
REMOTESERVER=test.appl.com
REMOTEPATH=batch/ftpTest
LOGIN=px
PASSWORD=abcd
ftp -n $REMOTESERVER << INPUT_END
quote user $LOGIN
quote pass $PASSWORD
for file in $(find $REMOTEPATH -type f -iname '*.csv'); do
 echo "$file"
 fileSize=`stat -c %s $file`
 echo "$fileSize"
 if [ $fileSize -gt 0 ]; then 
  echo "File exists"
 else
  echo "File does not exist" 
 fi
But its not working and throws error
find: /batch/ftpTest: No such file or directory
stat: too few arguments
Try `stat --help' for more information.
We only support non-print format, sorry.
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command

regards
Prashanth

You are mixing shell script commands into an FTP session. That doesn't work.

If you want more power from FTP, consider using Perl. See my Perl Net::FTP for examples.

Hi
Then can you please tell me how I can do this process?

regards
Prashanth

You mean you want me to write your script?

I gave three examples at that article. In comments people gave other examples. I think that's enough, but maybe not for you.

I'll tell you what: I'm heading out to the gym for a few hours. When I get back, if no one else has been bored enough to do your work for you, I'll lay you out a skeleton of what you need to do.

---------- Post updated at 09:14 AM ---------- Previous update was at 09:03 AM ----------

(My wife says we aren't leaving for 15 minutes)

After logging in etc., you are going to want to do something like

@files=$ftp->ls;
foreach (@files) {
   myfile=$_;
   next if not /.csv$/;
   $remotesize=$ftp->size($myfile);
   $ftp->get($myfile,$myfile);
   $localssize=(stat ($file))[7];

# compare, whatever
}

That's quick off the top of my head; could have mistyped anything - good luck!