When creating zip archive from some files on Desktop to USB stick (Files to Destination Archive button) Opus does it in some temp file on local hard disk and then copies final archive to USB stick. How can I make Opus create archive directly on USB stick? (option Use temporary file when copying to Zip files is off)
The temp dir will always be used when creating zips on removable drives.
The rationale is that removable drives are usually slower (and the temp file may be written to more than once, plus subject to virus scans as it is being built) and more likely to run out of space than the temp dir.
Rationale you mention is perfectly fine and desirable as a default Opus behavior. However I would like to ask for a notemp command flag/option such as Copy ADDTOARCHIVE notemp for when I am sure there is enough disk space on removable drive, have my antivirus set to not check inside archives and want to create a solid archive in a single pass rather than create+copy. This would save me some time in certain use cases I encounter every now and then (such as copying large amount of compressible files to USB stick and I'm in a hurry).
If using 7z is an option, the 7z plugin in Opus behaves differently and will write the archive directly to the USB stick, FWIW.
I tried it just now and it doesn't write it directly (it does create dummy 7z & tmp file on USB stick but both are not being written into). Opus says "< building archive >" with progress bar and then when progress bar reaches 100% it copies final build archive from hard disk tmp to USB stick (with progress bar remaining at 100% which kind of sucks because no copy progress is being reported - I would appreciate if that can be improved?).
How are you creating the archive? (Diff methods may go via a different route.)
Are you sure it isn't writing into the tmp file? Sometimes you have to manually refresh to see filesize changes to files which are in the process of being written (the change event and automatic refresh isn't triggered until the file is closed).
Via default Opus button: Archive Files > Files to Destination Archive (and then I select 7z or other format).
Yes, I spammed F5 manually and file sizes of temp & dummy files never changed.
FWIW, this is what I see when doing the same thing to a USB stick:
Tried it again with Program Files too and this time (for whatever reason) it didn't say "< building archive >" but there was usual nice progress bar window like in your screenshot. But still there were only dummy 32 byte .7z file and 8 byte .7z.tmp file both not growing over time.
So can GPSoft implement aforementioned notemp command argument?
I've looked at the archives plugin code which handles 7z files and it always creates the temp file in the output directory (and it's the only temp file it creates).
So if you're creating a 7z archive with Opus and not seeing the .tmp file's size increase, it either means the size is being misreported (possible with some filesystems which may not update the reported filesize until the file is closed, although my FAT32 USB stick does seem to update it) or the work is being done in memory and hasn't gone to disk yet (quite possible, since 7z can use large memory buffers and will compress multiple files as a single solid block).
(In fact, I found that I had started writing code for the archives plugin to use the temp dir instead on removable drives, but then decided against it -- making a different call to Opus's internal zip code -- and commented out that unfinished code before the plugin was ever released.)
If you're really sure the 7z archive is not being written direct to the output directory, I'd need to see some evidence to believe it and hunt for a possible reason, since it looks clear cut from the source that it could never happen. If you can find a temp file growing somewhere else or show process monitor logs showing something similar being created, then that would prove I'm wrong and that I may have overlooked something in the code.
(I can't immediately comment on the possibility of a "notemp" option for the zip code since I'm less familiar with it.)
You're right!
I checked with Process Monitor now and compared what happens when creating 7zip and zip and indeed Opus is not writing to the usual temp dir when creating 7z archive. It seems RAM caching is used when 7zipping. Possibly because of my 7zip settings (compress as much as possible) lots of data is kept in RAM for larger comparison window and yielding better compression so it would be unreasonable to (continue to) ask for flushing data to disk more often in this case.
As for support for direct writing to USB stick with formats other than 7zip... I don't really need it (at least not right now, regardless of topic title I actually use 7zip wherever I can)
Alright, thanks a lot Leo!
We'll add an option to control this in the next update.