snipt

Ctrl+h for KB shortcuts

Text only

batch code - unzip all file from folder + set date

rem set date format
set dt=%date:~0,2%-%date:~3,2%-%date:~6,4%
rem - date formant is now 21-07-2016

rem extract files - to folder in this format: U:\PATH\21-07-2016\PATH
for /R "FULLPATH\"%dt% %%I in ("*.zip") do (
  "%ProgramFiles%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" 
)

rem copy files - copy files from folder path with the date format above, e.g U:\PATH\21-07-2016\PATH\FILE
 copy /y "PATH\%dt%\PATH\FILENAME" "PATH"

Description

unzip files from folder.
can be done on folders or files with date on their name.

then it copies the extracted files to dedicated folder.
https://snipt.net/embed/cd275c0a55d3846c020a62b203eb8d76/
/raw/cd275c0a55d3846c020a62b203eb8d76/
cd275c0a55d3846c020a62b203eb8d76
text
Text only
11
2019-07-19T04:48:28
True
False
False
Jul 21, 2016 at 10:50 AM
/api/public/snipt/147440/
batch-code-unzip-all-file-from-folder-set-date
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rem set date format </span><span id="L-2"><a name="L-2"></a>set dt=%date:~0,2%-%date:~3,2%-%date:~6,4% </span><span id="L-3"><a name="L-3"></a>rem - date formant is now 21-07-2016 </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>rem extract files - to folder in this format: U:\PATH\21-07-2016\PATH </span><span id="L-6"><a name="L-6"></a>for /R &quot;FULLPATH\&quot;%dt% %%I in (&quot;*.zip&quot;) do ( </span><span id="L-7"><a name="L-7"></a> &quot;%ProgramFiles%\7-Zip\7z.exe&quot; x -y -o&quot;%%~dpI&quot; &quot;%%~fI&quot; </span><span id="L-8"><a name="L-8"></a>) </span><span id="L-9"><a name="L-9"></a> </span><span id="L-10"><a name="L-10"></a>rem copy files - copy files from folder path with the date format above, e.g U:\PATH\21-07-2016\PATH\FILE </span><span id="L-11"><a name="L-11"></a> copy /y &quot;PATH\%dt%\PATH\FILENAME&quot; &quot;PATH&quot; </span></pre></div> </td></tr></table>
batch.automation, unzip
--- 
+++ 
@@ -0,0 +1,11 @@
+rem set date format
+set dt=%date:~0,2%-%date:~3,2%-%date:~6,4%
+rem - date formant is now 21-07-2016
+
+rem extract files - to folder in this format: U:\PATH\21-07-2016\PATH
+for /R "FULLPATH\"%dt% %%I in ("*.zip") do (
+  "%ProgramFiles%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" 
+)
+
+rem copy files - copy files from folder path with the date format above, e.g U:\PATH\21-07-2016\PATH\FILE
+ copy /y "PATH\%dt%\PATH\FILENAME" "PATH"