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

need script

Options
  • 22-06-2006 11:26am
    #1
    Registered Users Posts: 5,399 ✭✭✭


    lads, not to sure on this one. I need a simple script:

    i need to delete a file in a folder on a server, and replace it with another file from another folder on another server. Sounds simple but i just cant get it to work

    this is what i have at the mo:

    cd z:
    del sdat*.*
    cd y:
    copy sdat*.* z:


    Full UNC path wont work :( so I have had to map the shares using Z:\ and Y:\


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    When you use CD with a drive mapping it doesn't actually change to that drive. Instead it changes to the directory on that drive without switching.


    Change ...

    cd z:

    to

    z:


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Probably not applicable in your case, but it'll also go the last active subdirectory on that drive, so the command

    z:

    could leave you in z:\subdir1\subdir2\ or whereever. Follow any drive changes with a

    cd\

    just to be sure you're working at the root level.


  • Registered Users Posts: 5,399 ✭✭✭ando


    Hobbes wrote:
    Change ...

    cd z:

    to

    z:

    yea that worked, thanks


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    You can also use PUSHD instead of CD.

    This works the same way as CD except it will move to the other drive as well and remembers your history. So after that if you type POPD then it will go back to the directory it came from.


Advertisement