View Single Post
Old 01-18-2016, 04:10 PM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I can't think of any archive utilities that automatically delete input files.
And specifying the output file can take any filename path.

...

Since my example was using the unix (linux/OSX) bash shell...
For a batch file, try something like:
Code:
cd C:\User\Docs\
for /d %%d in ("*") do (
    7z.exe a C:\path\to\archive\%%d.zip %%d\
)
I am not 100% positive that that is valid batch syntax (I am not a Windows user and I get confused sometimes ), but I *think* that will do it.
You can change the archive name and extension and 7-Zip should do the right thing automatically based on your chosen extension (*.zip, *.7z, *.tar.gz should all work).
%%d is the variable holding the name of the folder and also specifies the filename of the archive.

This uses the http://7-zip.org command-line 7z.exe so it must be in your PATH or else you must specify the full location of 7z.exe

Last edited by eschwartz; 01-21-2016 at 11:48 AM.
eschwartz is offline   Reply With Quote