Batch file Xcopy without manual F

All of the batch files we are using in our windows scheduler work except the batch file below.

xcopy C:\Webs\zUpFtp.txt C:\Webs\UpFtp_Products\zProducts_%date:~4,2%-%date:~7,2%-%date:~10%.txt /y

===

C:\Batch_Files>xcopy C:\Webs\zUpFtp.txt C:\Webs\UpFtp_Products\zProducts_01-11-2
009.txt /y
Does C:\Webs\UpFtp_Products\zProducts_01-11-2009.txt specify a file name
or directory name on the target
(F = file, D = directory)?

===
Any suggestions at to how we can eliminate a manual [ F ]
5 answers Last reply
More about batch file xcopy manual
  1. xcopy copy does not know how you want to handle the destination. I would recommend you xcopy /? to display a list of switches. In your case your have two choices. If i remember correctly copy command use to copy 1file a time, xcopy however, can copy a whole folder plust subdir if correct switch is used

    1. use copy command instead of xcopy
    2. add /I switch right behind the /Y switch, this usually does the trick in copying the whole folder. I'm not specifically sure for file, but i bet it should silently/automatically copy it for you.
  2. GreenMark said:
    xcopy copy does not know how you want to handle the destination. I would recommend you xcopy /? to display a list of switches. In your case your have two choices. If i remember correctly copy command use to copy 1file a time, xcopy however, can copy a whole folder plust subdir if correct switch is used

    1. use copy command instead of xcopy
    2. add /I switch right behind the /Y switch, this usually does the trick in copying the whole folder. I'm not specifically sure for file, but i bet it should silently/automatically copy it for you.


    I managed to overcome that only by supplying that 'f' letter from the additional input file, as follows:

    xcopy src dst < dummyf.txt

    where dummyf.txt consists of a single letter 'f'
  3. Hey guys,

    I had to deal with a similar problem today and found this somewhere.


    instead from a file "dummy.txt" you can echo 'f' - for file or 'd' for directory before the xcopy command using pipe symbol "|" on the same line.


    echo f | xcopy source_folder\file.txt destination_folder\file.txt

    or

    echo d | xcopy source_folder\file.txt destination_folder\file.txt

    Hope this helps!

    Venny 【ツ】
  4. Hi there,

    I just tested, the dummy file works fine, but the "echo f" method doesn't seem to work.

    -G

    Quote:
    Hey guys,

    I had to deal with a similar problem today and found this somewhere.


    instead from a file "dummy.txt" you can echo 'f' - for file or 'd' for directory before the xcopy command using pipe symbol "|" on the same line.


    echo f | xcopy source_folder\file.txt destination_folder\file.txt

    or

    echo d | xcopy source_folder\file.txt destination_folder\file.txt

    Hope this helps!

    Venny 【ツ】
  5. Sitting with the same problem, I've now also tested the above options, and the echo f | xcopy ... worked 100%.
Ask a new question

Read More

Products Windows XP