Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Problem with XCOPY  (Read 33048 times)

0 Members and 1 Guest are viewing this topic.

llmeyer1000



    Intermediate

    Thanked: 1
    Re: Problem with XCOPY
    « Reply #15 on: May 30, 2008, 02:48:14 PM »
    Yeah! I got a little carried away trying to prove a point.  ::)

    It's really quite simple. Quote from:
    Batfile Tricks & Tips
    Quote
    2.   One or more . (dots) can represent a directory.
    Sometimes it's easier to use dots to represent directories. For example, if you'd like to move a file from another directory to the current, instead of writing the path to the current directory (which move.exe requires), use a dot:  MOVE.EXE Path\anyfile .

    This can be demonstrated with the DIR command.
    One dot represents the current directory:  DIR .
    Two dots represent the parent directory:  DIR ..
    Three dots represent the directory above that:  DIR ...
    And so on.

    Most of the time a single dot will be treated the same as *.*, but not always. Sometimes *.* will work and . does not. And other times . will work when *.* does not. I don't have a hard and fast rule on when and where, but if *.* doesn't work, try DOT.

    Sometimes the DOT is the only way to get DOS to recognise a directory. The root directory is the primary example. There are at least 2 commands ( RD & Subst) that require a directory name that, when you want to specify the root directory, the only way that works is "[driveletter]:\." (true at least in XP pro)  I learned through trial and error that to be true, and there are other places that the DOT will work better.

    If you Google search for the dot directory, most of the references are from Linux users. Apparently the use of the dot directory is more widely used in Linux than DOS/Windows, but there are times in DOS also when it it invaluable.

    On the following blog, Martin Zugec acknowledges that the dot is better than the nul.
    Martin Zugec blog

    EDIT 05/30/2008 08:47 PM EST

    (In your case, I first recommended (without testing) adding the "dot" in the destination path
    Code: [Select]
    xcopy /E "C:\Flash_Copy\temp" %DriveLetter%:\.After testing it myself, I found that the secret to getting the command to work was in completing the source path as follows. In this case the *.* worked better than the single dot
    Code: [Select]
    xcopy /E "C:\Flash_Copy\temp\*.*" %DriveLetter%:\*.*
    For whatever unknown reason , the source path without the \*.* is OK for Xcopy if the drive has not been formatted just prior, but after a drive was formated, the Xcopy needed a complete source path for it to work.

    Why did Xcopy require a more complete command line after the format? I can't tell you. But:

    It's best not to ASSume that DOS will be able to figure out exactly what you want to do.
    It is always better to give dos the full path, even though many times it may work without it.
    « Last Edit: May 30, 2008, 06:47:59 PM by llmeyer1000 »

    batchfiles

    • Guest
    Re: Problem with XCOPY
    « Reply #16 on: July 31, 2009, 03:23:41 AM »
    Rehashing this from more than a year ago:

    Thank you so much for this solution:


    The following line is the BEST CHOICE. It is the MOST COMPLETE in the eye's of "DOS"
    Code: [Select]
    xcopy /E "C:\Flash_Copy\temp\*.*" %DriveLetter%:\*.*

    It just helped me solve a problem I had at the end of a long work project. I had written a little tool to update flash drives automatically and it all worked fine in one folder. Now I wanted to use it for new content I had created and boom! Error. I had no idea what the problem was until I found this topic.

    Thanks, llmeyer  :)