linux - Count number of files in a remote directory using SFTP -


this question has answer here:

i writing script in bash , need count how many files starting ddd in remote directory using sftp. after download each file, them can compare how many files had in remote directory , how many files downloaded. check if match , such.

i doing this:

echo ls -l | sftp "user@$123.45.67.8:/home/user/datafolder/ddd*" | wc -l

the 1 above works, when run downloads files local folder, not want.

how can count number of files , not download them. want download them in part of code.

as said in comments best way using ssh. outputs wanted

ssh user@123.45.67.8 ls /home/user/datafolder/ddd* | wc -l


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -