Sign in with
Sign up | Sign in
Your question

Batch file Xcopy without manual F

Last response: in Windows XP
Share
January 12, 2009 1:12:06 AM

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 ]
February 24, 2009 6:45:31 PM

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.
June 19, 2009 11:12:53 AM

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'
Related resources
Anonymous
November 11, 2009 6:40:06 PM

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 【ツ】



December 14, 2011 9:16:55 PM

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 【ツ】

July 17, 2012 7:58:49 AM

Sitting with the same problem, I've now also tested the above options, and the echo f | xcopy ... worked 100%.
!