Menu

7Zip- consecutive numbers or Date

Help
2014-05-10
2014-05-11
  • Jürgen Ide

    Jürgen Ide - 2014-05-10

    Hello,
    I want to save a target file with consecutive numbers:
    Example
    Scope (1). Zip, Scope (2). Zip .... Scope (s). Zip
    7z a-tzip C: \ Backup \ Scope.zip C: \ Program Files \ Scope.mdb?

    or
    attach to each file name the date and time
    Can anyone tell me if and how I feel?
    Thank you

     
    • fernando

      fernando - 2014-05-11

      Use index file to keep track of number.

      If index file does not exist write one with value 1
      Put number in variable I
      Add 10000 to variable I and put in variable J
      Run archive command - archive name includes 4 right characters of variable J
      Increment variable I by 1
      Write variable I to index file

      Result: Scope(0001).zip, Scope(0002).zip, ...., Scope(9999).zip ; then rolls over.

      @ECHO OFF
      IF NOT EXIST C:\Backup\ScopeIndex.dat > C:\Backup\ScopeIndex.dat ECHO;1
      SET /P I= < C:\Backup\ScopeIndex.dat
      SET /A J=%I% + 10000
      7z a -tzip C:\Backup\Scope(%J:~-4%).zip "C:\Program Files\Scope.mdb"
      SET /A I=%I% + 1
      > C:\Backup\ScopeIndex.dat ECHO;%I%
      ::
      
       

      Last edit: fernando 2014-05-11

Log in to post a comment.