1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Date and Time

Discussion in 'T&T - Aliases' started by harvey, Jul 14, 2011.

  1. harvey

    harvey

    Messages:
    11
    I have been using TCC since it was known as 4Dos. I have created aliases for adding files to a zipped file.

    wz="c:\Program Files (x86)\Winzip\wzzip.exe"
    zm=wz -m %1 %2 (where %1 is the name of the zipped file to create/use and the %2 are the files to add/move.)
    zmt=wz -m %1 (I need code to add the date and time to %1) %2

    I would like to make the alias create the zipped file with its name myfile071320111115.zip
    Where the 07132011 is the date and the 1115 is the time.
    I would like tcc to be able to do this without the need for me to do it manually like Ren myfile.* myfile071320111115.*

    Any help would be appreciated.
  2. Charles Dye

    Charles Dye Super Moderator Staff Member

    Messages:
    2,548
    The current date and time, or the date and time from the file's time stamp?
  3. harvey

    harvey

    Messages:
    11
    The current date and time to be appended to the file's name...
    File = Myfile
    When done... MyfileDateTime.zip where datetime come from the system clock.
  4. K_Meinhard

    K_Meinhard

    Messages:
    226
    Hallo harvey,


    I'd prefer the format 20110713111508 (yyyymmddhhmmss) because then its
    easy to sort the files chronoöogically, and adding seconds, your less
    likely to end up with 2 identical names.

    Best regards,

    * Klaus Meinhard *
    <www.4dos.info>
  5. Charles Dye

    Charles Dye Super Moderator Staff Member

    Messages:
    2,548
    Well, you could start with something like this:

    Code:
    alias zmt=`echo wz -m %@path[%1]%@name[%1]-%@format[02,%_month]%@format[02,%_day]%[_year]%@format[02,%_hour]%@format[02,%_minute].zip`
    
    Test that, and if it gives the kind of filenames you want, remove the ECHO.
  6. Charles Dye

    Charles Dye Super Moderator Staff Member

    Messages:
    2,548
    It's also somewhat easier to code....

    </www.4dos.info>
  7. samintz

    samintz Scott Mintz

    Messages:
    869
    Just in case you missed it, the command
    would use the variable _DATETIME to get the current date and time.

    alias zmt=`wz -m %1%_DATETIME`

    -Scott

    Charles Dye <> wrote
    on 07/15/2011 10:12:40 AM:


    because then


Share This Page