Zip files to Samba destination

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Zip files to Samba destination

Post by *Som30ne »

Hello.

I was wondering if there is a way to select files on android device,
select "Zip" operation,
and choose a SAMBA folder as destination.

Trying to type
///LAN/ServerName/Folder into the zipTo dialog
resulted an error (zip is not supported, or something of that sort).

It would be a great feature to allow simple backup of complete folders to a PC.
(Instead of copying all the files to the PC and zip them on the PC)

-- crating a ZIP file on the device and transferring the ZIP to the PC is a problematic process,
as it will take longer, and the need to have a lot of spare storage on the device,
to hold the content expanded and zipped concurrently.

Thanks
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Zip files to Samba destination

Post by *ghisler(Author) »

Currently it's not possible to pack directly to a plugin, sorry.
Author of Total Commander
https://www.ghisler.com
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Re: Zip files to Samba destination

Post by *Som30ne »

Thanks for the quick reply.

It would be interesting to know why that is.

Assuming a file is being opened for writing,
and a stream of bytes is sent as the content,
why is there a difference between copying an existing file,
and streaming a zip-stream to a plugin in general (and samba specifically)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Zip files to Samba destination

Post by *ghisler(Author) »

There is no random access to files with plugins. Random access means that you can reposition the current write position randomly and write there. This is needed when packing to write the actual compressed size of the packed file to the header in front of the compressed data after compressing it. There are variations of the ZIP format with the size header behind the data, but not all programs handle that well.
Author of Total Commander
https://www.ghisler.com
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Re: Zip files to Samba destination

Post by *Som30ne »

Thanks for the tech. info.
This makes me wonder how java ZIP stream is able to create zip files,
considering you can transmit this stream over TCP, and unzip it as stream on the other size,
while - it also creates a legal ZIP file when written to the disk.
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Zip files to Samba destination

Post by *Usher »

Som30ne wrote: 2019-09-20, 15:27 UTC Thanks for the tech. info.
This makes me wonder how java ZIP stream is able to create zip files,
Files may be stored in an archive with NO compression.
Andrzej P. Wozniak
Polish subforum moderator
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Re: Zip files to Samba destination

Post by *Som30ne »

Usher wrote: 2019-09-20, 19:20 UTC Files may be stored in an archive with NO compression.
Thanks for the reply.

Yes, they absolutely can, and yet, Java can actually compress them over TCP.

Below is a link to a small eclipse project, containing java sources that show simple java zip compression.
One of the classes is writing the output zip to a local file,
Another writes the output over a TCP connection, that eventually writes it into a file on the disk.

No 3rd party libraries used, only java built-in runtime classes.

To test if this is achieved by processing the full data in memory before writing to the output stream,
the program was ran with limited memory (-Xmx1024k = limited to 1MB of heap usage for data),
and could still produce a compressed zip entry of about 100MB,
with the required data, without crashing.
My conclusion from this,
is that the data is not accumulated into memory before transmitting it over the TCP.

(Not much error handling is done there, just a simple java program to demonstrate the capability,
almost any error encountered during it's operation would cause it to crash)

The output zip files were tested with 7Zip (windows) and with winRar.

https://mega.nz/#!gHBn1QIC!wo5IJECy59oFbHojMErW-2Gg6CNa0DYwzOqOFc5W8oA

Hope this could help with analysis of how this is done,
and that something similar will allow creating ZIP files directly to the SAMBA plugin.

Thanks

  
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Re: Zip files to Samba destination

Post by *Som30ne »

Just wondering if this request is considered as candidate for implementation
JOUBE
Power Member
Power Member
Posts: 1447
Joined: 2004-07-08, 08:58 UTC

Re: Zip files to Samba destination

Post by *JOUBE »

Som30ne wrote: 2020-05-30, 23:56 UTCJust wondering if this request is considered as candidate for implementation
I think it is not. Because of the very simple solution (as you write yourself):
Som30ne wrote: 2019-08-28, 15:44 UTC copying all the files to the PC and zip them on the PC
JOUBE
Som30ne
Junior Member
Junior Member
Posts: 27
Joined: 2019-08-28, 15:37 UTC

Re: Zip files to Samba destination

Post by *Som30ne »

JOUBE wrote: 2020-05-31, 09:22 UTC
Som30ne wrote: 2020-05-30, 23:56 UTCJust wondering if this request is considered as candidate for implementation
I think it is not. Because of the very simple solution (as you write yourself):
Som30ne wrote: 2019-08-28, 15:44 UTC copying all the files to the PC and zip them on the PC
JOUBE
Yes, but this is a 2 step scenario that requires twice the disk size on the destination,
while Zipping directly to the destination is a single step that does not require extra space.
Post Reply