# Solved: Batch File help - XCOPY command



## trippnwo

Hi,

My work is trying to run a batch file and is having problems getting it to work properly.

It is supposed to go to the D:\ drive - then to the fkormos\files\ directory.

Once there, it should copy all the files in fkormos\files into all the directories in the 5 commands below.

It should then delete all the files in the original directory and close.

Attached is a screen shot of what it does.

This batch file is stored in fkormos\files and a user logs in VIA ftp, then uploads the files to that directory, then runs the batch file. We are testing it on a machine where the user has full privileges on everything.

The drives X and F are networked drives.

Any help is greatly appreciated.

Thanks - Alan


d:
cd\fkormos\files
xcopy d:\fkormos\files\*.* d:\fkormos\files\bk\
xcopy d:\fkormos\files\*.* x:\bk\faye\
xcopy d:\fkormos\files\*.* x:\files\
xcopy d:\fkormos\files\*.* d:\archive\
xcopy d:\fkormos\files\*.* f:\Backup\
echo Y | del d:\fkormos\files\
exit


----------



## JohnWill

Let's see:

You have no space between the *cd* and the *\fkormos\files* in this command: *d\fkormos\files*

Both the X: and F: drives appear to not be recognized, so there's something wrong with the mapping, or those folders don't exist on the target drives. See the _invalid drive specification_ errors for any copy to those drives.

There are no files in the folder *d:\fkormos\files\*, so nothing is copied.


----------



## trippnwo

thanks - i didn't even notice that...

the drives are all mapped. 

Are the directory paths case sensitive?


----------



## trippnwo

hi - just wanted to let you know I got it running locally but it wont run when I log in VIA ftp...

just to take a stab at it, here is a screen shot of serv-u and the mapping properties (image removed). I think it has to do with the fact that the x:\files is being mapped as files...

what do you think? How could it be run if serv-u sees X:\Files\ as Files


----------



## trippnwo

i figured it out

I had to define a command in the FTP client in order to run it. 

site exec /username/username.bat

works like a champ now - 

thanks for the help.


----------



## JohnWill

Glad you found a solution.

*You can mark your own threads solved using the thread tools at the upper right of the screen.©*


----------



## jcdizon103178

Hi. James here from Philippines. is there anyone can help me with xcopy command in DOS Batch File. Actually, i can successfully copy files from one drive to another drive..
My command is here
xcopy c:\test d:\test /e /i /y /d

My question now is, is there a way that i can have a log file that will give me informations that the files were copied with date and time specified?
i have tested

xcopy c:\test d:\test /e /i /y /d > log.txt

but it only gives me info that the files were copied and no specified date and time.


your help is very much appreciated. 
-james


----------



## TheOutcaste

It's best to start a new thread rather than adding onto an old one, especially if it's marked solved. I almost didn't look at this.

Anyways, just echo the date and time to the file first. Also helps to add a seperator if you are going to be reusing the log.txt file. Note the doubled greater than symbols (*>>*), this will append to the log.txt file, rather than creating a new one:


Code:


Echo. >>log.txt
echo.---------------------------------- >>log.txt
echo %date% %time% >>log.txt
echo.---------------------------------- >>log.txt
Echo. >>log.txt
xcopy c:\test d:\test /e /i /y /d >> log.txt

Running the batch twice in a row results in this:



Code:


---------------------------------- 
Thu 05/22/2008 13:23:56.53 
---------------------------------- 
 
C:\test\big 1.txt
C:\test\modtst.cmd
C:\test\ptst.cmd
C:\test\times.txt
C:\test\times2.txt
C:\test\tst.cmd
6 File(s) copied
 
---------------------------------- 
Thu 05/22/2008 13:25:26.44 
---------------------------------- 
 
0 File(s) copied


----------

