MSFN Forum: Batch Command... - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Batch Command... to copy a whole folder... Rate Topic: -----

#1 User is offline   Stealth870 

  • Newbie
  • Group: Members
  • Posts: 45
  • Joined: 13-November 03

Posted 14 November 2003 - 04:02 PM

How do I make a command to copy a whole folder? Seeing as how if I put:

ECHO
ECHO Copying...
COPY "folderdirectory1" "to2nddirectory"

Only works for a file... :)


#2 User is offline   gosh 

  • gosh 2.0
  • Group: Patrons
  • Posts: 2,347
  • Joined: 03-October 03
  • OS:none specified
  • Country: Country Flag

Posted 14 November 2003 - 04:05 PM

C:\>xcopy /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

C:\>

#3 User is offline   Stealth870 

  • Newbie
  • Group: Members
  • Posts: 45
  • Joined: 13-November 03

Posted 14 November 2003 - 04:37 PM

Sweet...

If I make it extract to a non-existing folder, will it create it on its own? Or would I have to add -T?

#4 User is offline   Gism0 

  • Huh?
  • PipPipPip
  • Group: Members
  • Posts: 473
  • Joined: 11-November 03

Posted 14 November 2003 - 09:51 PM

While we are on the subject, in one of my batch files (runs at guirunonce) i have:

XCOPY "%systemdrive%\Install\Profiles\*.*" "%systemdrive%\Documents and Settings\" /E /C /Y /Q /H

and a profiles folder containing All Users\Start Menu\etc and Default User\Start Menu\etc

it copies fine, except for some reason they are all in UPPER CASE, which makes the start menu look fairly nasty!

The filenames are all formatted fine too :s

#5 User is offline   Gism0 

  • Huh?
  • PipPipPip
  • Group: Members
  • Posts: 473
  • Joined: 11-November 03

Posted 15 November 2003 - 09:51 PM

anyone? :/

#6 User is offline   Gism0 

  • Huh?
  • PipPipPip
  • Group: Members
  • Posts: 473
  • Joined: 11-November 03

Posted 16 November 2003 - 01:05 PM

hrmf, guess i'll just have to make a batch file to move stuff about in the start menu instead

#7 User is offline   un4given1 

  • Elaborate Dreamer
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,796
  • Joined: 25-September 03

Posted 16 November 2003 - 01:20 PM

I believe that XXCOPY will help you....

http://www.xxcopy.com/

#8 User is offline   Gism0 

  • Huh?
  • PipPipPip
  • Group: Members
  • Posts: 473
  • Joined: 11-November 03

Posted 16 November 2003 - 08:26 PM

un4given1, on Nov 16 2003, 01:20 PM, said:

I believe that XXCOPY will help you.... 

http://www.xxcopy.com/

thanks, i installed it but it does the same thing :)

#9 User is offline   fillalph 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 324
  • Joined: 29-July 03

Posted 11 February 2005 - 12:50 AM

In side my directory I have a bunch of program files, a cmd file, and a link file. What I would like to do is copy the entire contents to this directory excluding the .cmd and .lnk file. I tried to read up on the parameter exclude, but I couldn't figure it out.

XCOPY /E /Q /Y /EXCLUDE:.cmd "%systemdrive%\installs\notebook\syncback\*" "%ProgramFiles%\SyncBack\"


Thanks
]Bonkers[

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy