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

Copy in DOS

  • 12-11-2004 10:00pm
    #1
    Registered Users, Registered Users 2 Posts: 37,303 ✭✭✭✭


    Hi,
    I'm trying to do a batch file in DOS. It'd be easier than doing one in VB. The copy command has me a bit stumped. I'm trying to copy files from "files" directory to the current directory
    I've tried
    copy files/*.* /
    
    but it comes up with
    The syntax of the command is incorrect.
    
    I can't do a full path, as I'm trying to do a generic program, for any user, so that they can place the files folder and the batch file in the folder, and update it.

    Example;
    copy files to [current directory] from /files
    copy files to [current directory]/bins from /files/bins
    copy files to [current directory]/prog from /files/prog

    =-=

    If a move command will work instead, I'll do that. Any help would be nice.

    Thanks,
    the_syco


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    For a man-like help page, use copy /?


  • Registered Users Posts: 260 ✭✭DivX


    Try the following which should work.


    COPY .\Files\*.* .\


  • Registered Users, Registered Users 2 Posts: 37,303 ✭✭✭✭the_syco


    DivX wrote:
    Try the following which should work.


    COPY .\Files\*.* .\
    Thanks! Was using / instead of \ (I blame Windows :rolleyes: )


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


    You could also use Xcopy.
    but the syntax is VERY version specific Dos Mode/Windows9x/NT/2K/XP use different options for somethings.

    Move only works on the same drive - it won't cut and paste files.

    another tip - create a text file with the letter N on each line.
    you can pipe this in to copy or xcopy as a way of not overwriting files

    copy x:\*.* *.* <No.txt

    If using a command console (not dos mode)
    Xcopy \files\*.* *.* /d
    Xcopy \files\bins\*.* *.* /d
    Xcopy \files\prog\*.* *.* /d

    the /d means only copy newer files - this would speed up copying

    Xcopy \files\*.* *.* /d /S
    the /s would copy sundirectories as well.

    NB in XP you'd have to pipe the letter Y or A if running in a batch file to get xcopy to overwrite files


Advertisement