Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get size of file on remote server

Tags:

sftp

I have a requirement where I need to do SFTP connection to remote server, get the size of the file on remote server and depending on the size, i need to get the file onto local server. Is there any command in SFTP to get the size of the file.

like image 337
Gablu Avatar asked May 16 '17 14:05

Gablu


2 Answers

If you'd like the size output to be human readable, try: ls -lah

like image 84
James Jones Jr. Avatar answered Jan 04 '23 01:01

James Jones Jr.


You can get the file size of the remote files using the ls command by passing parameters.

To get Size of the file pass ls -l

To get Size of the file (HIdden files included) ls -al

To get it in human readable format pass ls -lh or ls -alh

like image 22
Jakuje Avatar answered Jan 04 '23 01:01

Jakuje