#1
  1. In the midst of insanity
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    UK
    Posts
    182
    Rep Power
    14

    Batch File Dates


    Hello again

    As you can see form my last post, I'm really stuck when it comes to DOS commands (absolute novice). I need to create a batch file whose purpose is to:

    Create a mapped drive - done this OK.

    Check to see if mapped drive exists - need help with this one, who do I get some sort of boolean return to see if drive exists?

    Check to see if a flag file exists on mapped drive OR check the date on a file is less than x days old - having really troubles with this one, how do I capture the number of days in a variable?

    Backup/Copy the mail '.pst' file to mapped drive - done this OK.

    Check if file exists on remote drive. - think this one will be ok with if(exists(filename))

    If anyone can help or point me in some sort of direction toward success, I will be eternally grateful.

    Cheers
    Take it easy - but take it!
  2. #2
  3. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    Personally i don't think DOS batch files would be able to accomplish all of this. I have had to do similar things and I wrote a PHP script which I then ran using the PHP interpreter. This was an easy way to solve my problem. DOS batch files were designed just to run a batch of commands... checking files and that sort of thing was not really their purpose. You might be able to get programs that give it that functionality, but i dont like the chances.
    - Andreas Koepke

    Koepke Photography

  4. #3
  5. In the midst of insanity
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    UK
    Posts
    182
    Rep Power
    14
    Thanks for your help Andreas. I guess it is very limited as to what commands etc you can use in a batch file. I'm now thinking of either:

    installing a PHP intepreter and using a PHP script
    OR
    installing bash utils (for windows) thingy and using a bash script

    I guess installing the bash tools would take up less space and time etc What do you think/suggest?
    Take it easy - but take it!
  6. #4
  7. Second highest poster :p
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2001
    Posts
    7,322
    Rep Power
    33
    If its only going to be used for that then i would get the bash utils. I had installed PHP on the system I was using already so that was why it was the most logical thing to use, but it does have quite a large size and would be a serious underuse of its power doing something like that.

    With bash scripts & utils you have access to that sort of information that you need so it should work well.
    - Andreas Koepke

    Koepke Photography


IMN logo majestic logo threadwatch logo seochat tools logo