I'm trying to create a backup script with 7-Zip. I have everything else done already, but these two issues are still blocking me.
Firstly, I want to add a timestamp with a create date like this: 3.11.2010 Backup.7z
So the dd.mm.yyyy
format. I tried several versions I found on the Internnet, but none of these would work the way I wanted. What should I do?
Secondly, I only want to add the last modified folder to the archive (no matter how many folders exist in directory; I just need the latest). Basically, I have something like this:
App_v.1.0.0.4.exe_Url_2um2yok5q4vpoxnvnscpq3adfwff4wsmi
App_v.1.0.0.5.exe_Url_ft4mnvbu54hfrgdhxrahj4imlmermdsoe
So I want to add the newest (1.0.0.5) folder only. These folders change and always have different names so name based sorting would be a bad idea.
Best Answer
Will create the archive with
DD.MM.YYYY Backup.7z
Format.Explanation: Echoing
%DATE%
prints the date in your regional date format setting.By using
~x,y
specifier your are doing an in string/substring extraction of the string - wherex
is the starting character andy
number of characters you wish to extract.On your second point:
should do it.