Pinto1uk said:
Hi, i have tried to create a simple bat file that copies a folder from one
directory to another, but it doesn't work. i am using windows xp. the
contents of the file are:
cd c:
cd C:\Documents and Settings\Rafik\My Documents
copy C:\Documents and Settings\Pinto\My Documents\Pinto C:\
can anybody help.
I wouldn't reccomend copying a lot of files into the root directory. There
is a strict limit to the file count that can be stored there. Folders are
included in the count, so don't get carried away putting folders in the root
directory either.
Setting the directory to the source folder and then using the entire path in
the copy command seems redundant. The file name should be enough. Note that
without the backslash a path designation designates the current directory on
that drive. After you change the directory to "C:\Documents and
Settings\Pinto\My Documents" any files copied to "C:" will be placed in that
folder, accomplishing nothing. You would have to use "C:\" to place them in
the root directory. See below about paths that have spaces in them.
Is "Pinto" just a file or a folder within "My Documents"? Application and
data files normally use an extension (.txt, .doc, .htm etc)
Your command tries to copy "C:\Documents" to "and". Without quotation marks
the first space deliniates the end of the source file name AND the beginning
of the destination path. If your path combined with your name contains ANY
spaces you have to enclose the entire path and file name in a set of
quotation marks:
copy "C:\Documents and Settings\Pinto\My Documents\Pinto" C:\
To copy a folder and its contents consider the xcopy command with additional
flags. Xcopy also has the ability to store multiple files in memory, thus
switching betwen paths quicker and completeing faster. This helps A LOT when
copying multiple files from one floppy to anouther! To see a list of flags
for a DOS/Command Prompt command type the command followed by a slash and a
question mark in a Command Prompt window:
xcopy /?