Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

help with script (unix/windows paths)

  • 20-06-2005 01:46PM
    #1
    Moderators, Arts Moderators Posts: 36,246 Mod ✭✭✭✭


    I'm trying to automate a process and can't decide between a DOS-only approach, unix-only or a mixture of the two. Has anyone any tops for the following?

    I want to take two windows-style paths, extract a couple of arguments from them and create directories using these arguments. e.g. the files are currently on:

    g:\projectnumber\filetypes\subtype\batchnumber1 and
    g:\resources\othertype\batchnumber2

    I want to create paths called

    d:\projectnumber\batchnumber1 and
    d:\projectnumber\resources\batchnumber2 and copy the files into them

    I can do this with cut, mkdir and cp, but it's a bit of a pain having to wrap the windows-paths in quotes all the time.

    Next I want to launch a Windows executable (probably via a batchfile) and pass some of these parameters to it.

    This is probably very vague, but I'm wondering is there any way to do all this in one script, or by getting a unix script to create a batch file then run it?


Comments

  • Registered Users, Registered Users 2 Posts: 1,268 ✭✭✭hostyle


    I'm trying to automate a process and can't decide between a DOS-only approach, unix-only or a mixture of the two. Has anyone any tops for the following?

    I want to take two windows-style paths, extract a couple of arguments from them and create directories using these arguments. e.g. the files are currently on:

    g:\projectnumber\filetypes\subtype\batchnumber1 and
    g:\resources\othertype\batchnumber2

    I want to create paths called

    d:\projectnumber\batchnumber1 and
    d:\projectnumber\resources\batchnumber2 and copy the files into them

    I can do this with cut, mkdir and cp, but it's a bit of a pain having to wrap the windows-paths in quotes all the time.

    Next I want to launch a Windows executable (probably via a batchfile) and pass some of these parameters to it.

    This is probably very vague, but I'm wondering is there any way to do all this in one script, or by getting a unix script to create a batch file then run it?

    Sounds like the perfect job for perl?


  • Moderators, Arts Moderators Posts: 36,246 Mod ✭✭✭✭pickarooney


    Yeah? Might be worth my while finally getting round to learning it... :)


Advertisement