10finch46

Distinguished
Dec 25, 2008
2
0
18,510
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 ]
 

GreenMark

Distinguished
Feb 24, 2009
1
0
18,510
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.
 

grigorym

Distinguished
Jun 19, 2009
1
0
18,510


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'
 
G

Guest

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



 

tgnana

Distinguished
Dec 14, 2011
1
0
18,510
Hi there,

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

-G

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

sunjomar

Honorable
Jul 17, 2012
1
0
10,510
Sitting with the same problem, I've now also tested the above options, and the echo f | xcopy ... worked 100%.