Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

timestamping files

Options
  • 04-02-2005 1:10pm
    #1
    Closed Accounts Posts: 667 ✭✭✭


    Hi All,

    on my nix boxes i would

    mv /filesystem/file.tar.gz /filesystem/file.`date "+%Y%m%d%H%M"`.tar.gz

    to timestamp my backups that create outputs of same filename.

    any ideas of how to do same in W2K

    at present im having to

    move file file%random%

    to create copys so i dont overwrite existing.

    any ideas of easy way to timestamp in w2k dos ?


Comments

  • Registered Users Posts: 2,426 ✭✭✭ressem


    download the now command, part of the windows 2000/xp/2003 resource kit and use in place of date?


  • Closed Accounts Posts: 667 ✭✭✭loz


    thanks the info !


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    Also look into cygwin. (Site not responding for me right now)

    This is a port of loads of Unix utilities to Windows. I have bash, wget, usual shell commands, gcc and Palm development utilities all running on my XP box.
    Drives mounted as /cygdrive/c, /cygdrive/d etc. Brilliant. Free.

    Then you can use the same scripts on Windows and Unix, with some minor mods.


  • Closed Accounts Posts: 1,567 ✭✭✭Martyr


    This is batch file script code for timestamping a file in Win2k/XP
    %1 is the arguement..example, in the console
    C:\timestamp file.txt
    
    This would generate 04_02_2005_file.txt in current directory.
    @ECHO OFF
    @SET TODAYS_DATE=%DATE:/=_%
    @IF EXIST %1 (MOVE %1 %TODAYS_DATE%_%1) ELSE ECHO Error:%1 not found! 
    

    You could probably use copy/xcopy/rename..but i haven't tried these
    myself.

    If you place script in seperate batch file, it can be called from another
    script which would loop through a list of files, timestamping each one
    to specified location..

    If you're still unsure, check out this website for a list of useful
    information on batch file creation.

    http://www.ss64.com/nt/


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,687 Mod ✭✭✭✭Capt'n Midnight


    The exact opposite - how to turn OFF timestamps
    It speeds up NTFS slightly and it ain't much use since all usually tells you is when you ran nightly scheduled virus scan
    Perhaps if you had this enabled you could see the last access time


    REGEDIT4
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
    "NtfsDisableLastAccessUpdate"=dword:00000001
    

    Also to see timestamps in NTFS for Creation/Access/Written see:
    DIR /? to see the options for DIR /T


  • Advertisement
Advertisement