필터 지우기
필터 지우기

Is it possible to zip a list of files over ftp?

조회 수: 6 (최근 30일)
Thomas Kurian
Thomas Kurian 2023년 3월 9일
답변: Thomas Kurian 2023년 5월 10일
Hello
I have a camera saving a series of images on a remote computer that I would like to download. I am currently using ftpobj and mget running in a loop to get all the files which is quite time consuming. I was wondering if it is possible to zip the files remotely through matlab and just use mget for the .zip file
  댓글 수: 2
Stephen23
Stephen23 2023년 3월 9일
편집: Stephen23 2023년 3월 9일
"I was wondering if it is possible to zip the files remotely through matlab and just use mget for the .zip file"
For this to make any sense, the zipping would need to be performed by some application at the remote end (otherwise zipping using a local application would still require transferrring all file uncompressed data remote->local->zip locally... not much sense in that). So you would have to get MATLAB to request a remote application to perform the zip, before using FTP to transfer that zip file. You have not told us what OS or applications are available at the remote end.
Note that "FTP" stands for "File Transfer Protocol", and it has no provision for calling arbitrary applications at the remote end:
Thomas Kurian
Thomas Kurian 2023년 3월 9일
True. the remote computer is a linux computer so I can run zip through a bash script for example. But then the problem becomes getting Matlab to execute a bash script remotely. Is that possible? (Sorry this becomes a change of topic)

댓글을 달려면 로그인하십시오.

채택된 답변

Thomas Kurian
Thomas Kurian 2023년 5월 10일
I found this on File Exchange which works for me now, but over ssh instead of ftp
https://www.mathworks.com/matlabcentral/fileexchange/35409-ssh-sftp-scp-for-matlab-v2

추가 답변 (2개)

Sarvesh Kale
Sarvesh Kale 2023년 3월 9일
See if the following documentation helps, zip function matlab document . mget function in matlab. Example code usage is shown below
% assume that your folder has jpeg images you want to compress
% on remote computer
zip('backup',{'*.jpeg','*.jpg'}) % compress all files which are jpeg or jpg format to backup.zip
execute the below code on your local machine
% on local machine
s = ftp('your host address'); % enter your host ftp address in place of 'your host address' in single commas
mget(s,'backup.zip') ;
I hope the above helps in your query.
Thank you.
  댓글 수: 4
Thomas Kurian
Thomas Kurian 2023년 3월 9일
편집: Thomas Kurian 2023년 3월 9일
Yes. I guess I will have to do something like this in the end. This solves my problem, but I guess the answer to the question is that it is not possible entirely in Matlab
Stephen23
Stephen23 2023년 3월 9일
편집: Stephen23 2023년 3월 9일
"but I guess the answer to the question is that it is not possible entirely in Matlab"
This is not a MATLAB problem, but a conceptual problem. Zipping requires the CPU to process the data. MATLAB is running on your local CPU. So to use your local MATLAB to zip the data, you would need to transfer all of the data to your local computer, where your local CPU is, which can then locally zip the data. A local app running on a local CPU cannot suddenly jump through space and run on a remote CPU, to process some data there.
It has nothing to do with MATLAB, it applies to all applications.

댓글을 달려면 로그인하십시오.


Thomas Kurian
Thomas Kurian 2023년 3월 9일
편집: Thomas Kurian 2023년 3월 9일
So As Stephen23 points out this is not a matlab issue. I can't get matlab to zip files on a remote computer without transferring them first. So I need to log in to that computer and run a script of some kind to do the zipping for me.
this thread was helpful as to get that to work:

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by