bash - MIME type check via SFTP connection -
i want list images sftp , save list, script may further process it.
unfortunately, there many other files there, need identify images. filtering out wrong file extension, go step further , check content of file.
downloading check file --mime-type on local machine slow. there way how check mime type of file on remote sftp before download?
we found way, downloading first 64 bytes. lot faster downloading whole file, still enough see if looks image:
curl "sftp://sftp.example.com/path/to/file.png" -u login:pass -o img.tmp -r 0-64 file --mime-type img.tmp
Comments
Post a Comment