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.

Copy in DOS

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


    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, Registered Users 2 Posts: 259 ✭✭DivX


    Try the following which should work.


    COPY .\Files\*.* .\


  • Registered Users, Registered Users 2 Posts: 37,308 ✭✭✭✭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: 96,006 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