Page 1 of 1

unzip a file in a directory named as file+date+time

Posted: 17 Apr 2023 10:35
by Marco
I use this little script to unzip files in a directory named as file + date and time of zip file. I can use only in windows server 2019 changing the date format in 01.01.23. But i got an error under win10 home.

FOR /D /r %%F in (".") DO (
pushd %CD%
cd %%F
FOR %%X in (*.rar *.zip) DO (
"C:\Program Files\7-zip\7z.exe" e "%%X" -o"%%~nX"_"%%~tX" -aou
)
popd
)
if i have a file named "pippo.zip"
i obtain a directory named "pippo_01.01.23 12:35" ( assumed that the the date and time of creation of pippo.zip is 01/01/23 12.35)
how can i obtain a directory named "pippo_01_01_23_12_35" ? ( so i can use under win10 home)

Thanks in advance
Marco

Code: Select all

 INFO.BAT version 1.6
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Versione 10.0.19045.2846]
Product name           :  Windows 10 Home, 64 bit
Performance indicators :  Processor Cores: 8      Visible RAM: 33507176 kilobytes

Date/Time format       :  (dd/mm/yy)  17/04/23  18:16:13,22
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW
Extensions             :  system: Enabled   user: Enabled 
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  it-IT       Code Pages: OEM  850    ANSI 1252
DIR  format            :  15/04/23  07:01    34.359.738.368 pagefile.sys
Permissions            :  Elevated Admin=Yes, Admin group=Yes

                          Missing from the tool collection:  debug