cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: remote file size

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 12 May 2016 00:09:52 +0200

On Wed, May 11, 2016 at 02:25:54PM +0000, ganesh patwardhan via curl-users wrote:
> Is there any way to find out file size at FTP/SFTP server using
> 'curl' command.

The -I option will return the size in a pseudo-header on an FTP server, but not
on an SFTP server.

> My use case is:
> I will transfer file using curl (ftp/sftp) to server
> I want to read back file size from destination once transfer is complete.
> (I don't want to rely on success message from curl to assume complete file is
> transferred and written at destination )

Why not? curl should only return success if the file is completely transferred.
Checking the size afterwards is no guarantee of success, either, as the file
and file size could have changed between downloading and checking.

>>> Dan
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-12