Results 1 to 7 of 7

Thread: I am not able to do xcopy in DOS

  1. #1
    Join Date
    Jan 2010
    Posts
    52

    I am not able to do xcopy in DOS

    Hi friends, I am in a trouble please, help me out to fix this kind of problem with my command prompt.
    I am new in using DOS though i use my computer daily but never performed any kind of work in the DOS.
    When i was doing Xcopy using command prompt. At the c:\> prompt when I typed the following command

    xcopy /s/y "C:\documents and settings" "D:\documents and settings".

    After that i was getting Invalid Parameter i.e -"C:\documents

    Thanks in advance for the help.

  2. #2
    Join Date
    Jan 2008
    Posts
    3,388

    Re: I am not able to do xcopy in DOS

    In Xcopy command, the switches go to the end of the command line, like this given below:

    Xcopy "C:\junk\*.*" "D:\junk\" /s /y

    This line will copy everything in the junk folder in C: and then to a junk folder in D drive.
    First you have to make a "junk" folder on D: in this issue to work properly.

    Every day I do back up of my entire "My Documents" folder to a folder on D drive.

    The way I have written it, first time I ran the batch file, it backed up all the entire directory, but next time when I ran it, it backed up only the new files or the files that havebeen updated or changed.
    Now i run it in my shutdown batch file and it backs up few files and takes only a few seconds to run.

    Here is the text for the shutdown batch file:

    @Echo off
    cls
    xcopy "C:\Documents and Settings\Alex\My Documents\*.*" "D:\My Documents\" /s /y /H /R /D

    Remember to Back up my WordPerfect files.
    xcopy "C:\MyFiles\*.*" "D:\MyFiles\" /s /y /H /R /D

    Remember to Back up all the files for My Web Page.
    xcopy "C:\My web page\*.*" "D:\My web page\" /s /y /H /R /D

    Remember to Back up my email folders and address book.
    xcopy "C:\Documents and Settings\Alex\Local Settings\Application
    Data\Identities\{CC1A6FC7-0D07-4169-865D-56EBDD76EB8B}\Microsoft\Outlook Express\*.dbx" "D:\MyEmailFiles-Backup\" /s /y /H /R /D
    xcopy "C:\Documents and Settings\Alex\My Documents\My Address Books\*.*" "D:\My Address Books" /s /y /H /R /D

    Remember when the backup is done please Shutdown!

    %windir%\System32\shutdown.exe -s -t 00 -f

    In your case, you would be copying all the files in those folders, over and over again.
    Which is very time consuming
    I suggest you to add more switches like I have done to copy only new or changed files.

  3. #3
    Join Date
    Apr 2008
    Posts
    3,267

    Re: I am not able to do xcopy in DOS

    I'll provide you some examples about xcopy.

    1. xcopy c:\temp /e

    The above example is the basic xcopy command to copy the files, directories, and subdirectories to the directory you're currently in.

    2. xcopy "c:\documents and settings\hope" /e

    In the above example the xcopy command would copy all files and directories in the user "hope" directory to the directory or drive you're currently in.

    3. xcopy h:\*.* /a /e /k

    The above command would copy everything located on the H drive to the drive you are currently on.

  4. #4
    Join Date
    Nov 2005
    Posts
    1,203

    Re: I am not able to do xcopy in DOS

    After further examination, i was also encountered by this issue. However, i was able to copy the majority of all favorites by using the command which is given below.

    xcopy c:\windows\favorites\*.* /e /k /i /c

    I am under the impression that this issue is generated because of the way that Internet Explorer saves the URL using long file names as well as extended characters.

  5. #5
    Join Date
    Nov 2009
    Posts
    8

    Re: I am not able to do xcopy in DOS

    Personally in this type of situation I have always used 'robocopy' which is available for free from the Microsoft website. It is command line based and I believe that this isn't subject to the issues with long filenames.

  6. #6
    Join Date
    Apr 2008
    Posts
    3,295

    Re: I am not able to do xcopy in DOS

    If you are not able perform xcopy operation then you can create a batch program to perform xcopy operations and use the batch if command to process the exit code if an error occurs.
    For example, the following batch program uses replaceable parameters for the xcopy source and destination parameters:

    @echo off
    rem COPYIT.BAT transfers all files in all subdirectories of
    rem the source drive or directory (%1) to the destination rem drive or directory (%2)
    xcopy %1 %2 /s /e
    if errorlevel 4 goto lowmemory
    if errorlevel 2 goto abort
    if errorlevel 0 goto exit
    :lowmemory
    echo Insufficient memory to copy files or
    echo invalid drive or command-line syntax.
    goto exit
    :abort
    echo You pressed CTRL+C to end the copy operation.
    goto exit
    :exit

    You can use this batch program to copy all files in the C:\Prgmcode directory and its subdirectories to drive D, type:
    copyit c:\prgmcode D:
    Last edited by Lillebror; 28-01-2010 at 08:11 PM.

  7. #7
    Join Date
    Apr 2008
    Posts
    3,522

    Re: I am not able to do xcopy in DOS

    Some more xcopy commands:

    1.To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

    xcopy a: b: /s /e

    2. To include any system or hidden files in the previous example, add the/h command-line option as follows:

    xcopy a: b: /s /e /h

    3. To update files in the \Reports directory with the files in the \Rawdata directory that have changed since December 29, 1993, type:

    xcopy \rawdata \reports /d:12-29-1993

    4. To update all the files that exist in \Reports in the previous example, regardless of date, type:

    xcopy \rawdata \reports /u

    5. To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:

    xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out

    The file Xcopy.out lists every file that is to be copied.

    6. To copy the \Customer directory and all subdirectories to the directory \\Public\Address on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:

    xcopy \customer h:\public\address /s /e /k /p

    7. To issue the previous command, ensure that xcopy creates the \Address directory if it does not exist, and suppress the message that appears when you create a new directory, add the /i command-line option as follows:

    xcopy \customer h:\public\address /s /e /k /p /i

Similar Threads

  1. Log For xcopy batch file
    By Beverly Archer in forum Software Development
    Replies: 4
    Last Post: 31-03-2010, 01:31 PM
  2. Using XCOPY when directory has a space in name
    By Gavisht in forum Operating Systems
    Replies: 4
    Last Post: 31-03-2010, 11:25 AM
  3. what is different between xcopy and copy
    By Sabastiaan in forum Operating Systems
    Replies: 4
    Last Post: 23-01-2010, 03:19 AM
  4. How to run the Xcopy command on XP
    By Mansi gala in forum Operating Systems
    Replies: 3
    Last Post: 31-10-2009, 06:38 PM
  5. Running XCopy using AT command
    By Ian in forum Windows Server Help
    Replies: 8
    Last Post: 26-09-2007, 10:34 PM

Tags for this Thread

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
  •  
Page generated in 1,714,259,023.34494 seconds with 17 queries