Results 1 to 11 of 11

Thread: DOS commands

  1. #1
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default DOS commands

    I am trying to put together a bat file for an installer but it has been years since I used DOS. Does anyone know the command to copy a folder (and all its files/subfolders) to another folder?

    Code:
    md .\bi\ci\
    copy .\bi\* .\bi\ci\
    del /q .\bi\ci\ci\
    del /s /q .\bi\ci\data\world\maps\battle\custom\
    del /s /q .\bi\ci\data\world\maps\base\
    copy .\fe\* .\bi\ci\
    del /s /q .\bi\ci\data\world\maps\campaign\the_south\
    pause
    The first line works (so I have the right directory path settings!) but the second line results in a "specified file not found" error.

    I've tried all manner of variations. It seems to be only looking for files rather than folders I would guess?

    Thanks.

    EDIT: This is what I am trying to do

    1. Install via an installer the modfolder ("ci" in this case) of my mod into a temporary folder
    2. execute a bat file which:

    i. creates empty modfolder in RTW directory
    ii. copies the contents of the bi folder into the new ci folder
    iii. copies the ci folder into the bi folder
    iv. removes the original ci folder
    v. removes the custom and base subfolders from the bi/ci folder
    vi. copies the temporary modfolder ("fe") (installed by the installer) into ci
    vii. deletes the_south subfolder from the ci folder

    Slightly convoluted but a more direct approach resulted in cyclical copying error.
    Last edited by Dol Guldur; 01-28-2007 at 01:28.
    "One of the most sophisticated Total War mods ever developed..."

  2. #2
    Honorary Argentinian Senior Member Gyroball Champion, Karts Champion Caius's Avatar
    Join Date
    Aug 2006
    Location
    I live in my home, don't you?
    Posts
    8,114

    Default Re: DOS commands

    copy *folder to copy* *new folder with the files*

    try that.




    Names, secret names
    But never in my favour
    But when all is said and done
    It's you I love

  3. #3
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: DOS commands

    Nope.

    I think it might be a command I forgot about: XCOPY

    Code:
    md .\ci\
    xcopy .\bi\ .\ci\ /e
    xcopy .\ci\ .\bi\ci\ /e
    RMDIR /S /Q .\ci\
    del /q .\bi\ci\ci\
    del /s /q .\bi\ci\data\world\maps\battle\custom\
    del /s /q .\bi\ci\data\world\maps\base\
    xcopy .\fe\* .\bi\ci\
    del /s /q .\bi\ci\data\world\maps\campaign\the_south\
    pause
    Now lines 1 and 4 work but 2 & 3 are reporting an invalid path which does not make sense if 1 & 4 work. I could not copy the file directly as it reported a cyclical error (probably because I was copying to a subdirectory of it) so I have had to go about it by copying it somewhere else and then copying it again. Gah!

    Any dos guys out there?
    Last edited by Dol Guldur; 01-28-2007 at 01:16.
    "One of the most sophisticated Total War mods ever developed..."

  4. #4
    Member Member Phatose's Avatar
    Join Date
    Dec 2003
    Location
    PA, USA
    Posts
    591

    Default Re: DOS commands

    The obvious suspect on lines 2 & 3 is .\bi. I don't see any reference in the existing batch file to creating such a subdirectory. Where is the .\bi coming from, exactly? Unless the subdirectory \bi already exists in the directory you're running the batch file from, you'll have problems.

    Neither lines 1 or 4 would have problems if you're in the incorrect place - it's just removing a directory it created. For example:

    Your installer creates C:\mymod\bi
    Your batch file runs, but runs from C:\

    first line makes C:\ci
    second line looks for c:\bi which doesn't exist, so you get invalid path.
    third line looks for c:\bi\ci, which also doesn't exist, and you get an error.
    fourth line removes C:\ci, which does exist via line one.



    Let me guess - your installer creates the \bi subfolder, and you want to create \ci via the batch, not as a subfolder of \bi\, but as a sibling to it. But since your installer puts the batch file in that \bi directory, it's being run from that folder, so

    first line: makes a subdirectory in current directory named ci. You're IN bi, so you make bi\ci
    second line looks for \bi\bi, which doesn't exist
    third line looks for \bi\bi\ci, which also doesn't exist.
    fourth line removes bi\ci


    Solution: Insert a new line before all others: cd..
    Alternative solution: Move the batch file so it's in the same directory as the bi subfolder, instead of being inside the bi subfolder.
    that will move you one step up the directory tree, so you'll be where you should be.


    Thing to remember here is the . refers to the current directory, which will be wherever your batch file is run from.
    Last edited by Phatose; 01-28-2007 at 04:10.

  5. #5
    Cynic Senior Member sapi's Avatar
    Join Date
    Oct 2004
    Location
    Brisbane
    Posts
    4,970

    Default Re: DOS commands

    Phatose makes a good point, but i'd also question your usage of 'copy .\bi\* - i don't think the asterix is needed (as you want to copy the folder, not the files)
    From wise men, O Lord, protect us -anon
    The death of one man is a tragedy; the death of millions, a statistic -Stalin
    We can categorically state that we have not released man-eating badgers into the area -UK military spokesman Major Mike Shearer

  6. #6
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: DOS commands

    The batch file is in the correct place and the bi folder already exists. If ci is created (which it is) then it proves the path correct, an yet on those other lines it is reporting an invalid path.

    Very strange.


    The asterisk was merely a variation test, along with no asterisk and *.* etc.
    "One of the most sophisticated Total War mods ever developed..."

  7. #7
    Member Member Phatose's Avatar
    Join Date
    Dec 2003
    Location
    PA, USA
    Posts
    591

    Default Re: DOS commands

    You've seen the \ci actually created in the appropriate directory?


    Oh wait. I know what the problem is.

    Use xcopy .\ci, not .\ci\
    Last edited by Phatose; 01-28-2007 at 18:10.

  8. #8
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: DOS commands

    Yes - the install directory is set in the pathway by the installer itself (for the bat file). ci folder is created correctly.
    "One of the most sophisticated Total War mods ever developed..."

  9. #9
    Member Member Phatose's Avatar
    Join Date
    Dec 2003
    Location
    PA, USA
    Posts
    591

    Default Re: DOS commands

    See above post. The final \ in the xcopy path is the problem - just tested. Must be interpreting that as a subdirectory reference to an unnamed subdirectory.

  10. #10
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: DOS commands

    Phatose,

    That did it! Gah, I am so rusty!

    Big thank you.

    I can now move on to pinning down the rest of it!
    "One of the most sophisticated Total War mods ever developed..."

  11. #11
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: DOS commands

    Sorry not to update. The code is finished and working and can be found in the Rome directory after installing Forth Eorlingas.

    Other mods may adapt to their own needs if credit is given. Oh, and if you improve it then I want to know what you did :)

    I do not have time to write a tutorial, but PM me if you have problems. Maybe if I get as big enough response I might write a tutorial...
    "One of the most sophisticated Total War mods ever developed..."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO