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

Script to check file dates

Options
  • 16-01-2007 5:40pm
    #1
    Registered Users Posts: 245 ✭✭


    Hi,

    I'm looking to get a script (either vbs or a .bat file) that can check a file on 40 different PC's and return the modified date on that file. Anybody got an ideas. At the moment I can do a "DIR \\computername\share" and it will return the contents of the directory with that file which I then put in a .txt file, but it's still a bit messy.


Comments

  • Closed Accounts Posts: 461 ✭✭markf909


    Just having a quick look at the DIR command.

    If you do dir /T:[C|A|W] file.txt

    you can retrieve info on when the file was (C)reated, (A) Last accessed or (W) Last Written.

    I guess you could output the result to a txt file and then use sed to extract the info needed.


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


    http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx
    if you enter a computer name of "\\*" PsExec runs the applications on all computers in the current domain.

    you can then redirect the output to unique files on a server cos the cmd.exe runs locally on the computer
    psexec \\* cmd.exe /k dir filename > \\server\share\%computername%.txt

    for cmd it's /k or /c CBA looking it up ;)

    if you use -c you can copy a batch file to each machine if you need to do fancier stuff


Advertisement