Is it possible to zip a list of files over ftp?
3 views (last 30 days)
Show older comments
Thomas Kurian
on 9 Mar 2023
Answered: Thomas Kurian
on 10 May 2023
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 Comments
Stephen23
on 9 Mar 2023
Edited: Stephen23
on 9 Mar 2023
"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:
Accepted Answer
More Answers (2)
Sarvesh Kale
on 9 Mar 2023
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 Comments
Stephen23
on 9 Mar 2023
Edited: Stephen23
on 9 Mar 2023
"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.
See Also
Categories
Find more on FTP File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!