karan
karan

Reputation: 197

Check remote directory size before file transfer in SFTP

I have to check remote directory size before transferring file using SFTP. Please help how this can be achieved? I will transfer file only if remote directory size is less than defined threshold.

Upvotes: 4

Views: 8437

Answers (1)

redneb
redneb

Reputation: 23870

You could run the following command

ssh USER@SERVER du -bs "/path/to/remote/directory"

and capture its output.

Upvotes: 2

Related Questions