# Batch script to copy files !!



## simplyeshu (Feb 4, 2012)

Hello Frens,

I have written a small batch script to move the files from two directories to one main directory. It should record all the activities in a log file like files have been moved successfully from directory b to directory A and total number of files moved along with timestamp but its not working. Can you please review and help? Also tell me if we can automate this to run everyday at particular time (between 10pm - 11pm)

echo "files moving at "%date%-%time%" >> c:\OutputFile.log
move "C:\A\*.*" "C:\Test" >> C:\OutputFile.log
move "C:\B\*.*" "C:\Test" >> C:\OutputFile.log
echo "files moved at "%date%-%time%" >> c:\outputfile.log


----------



## Squashman (Apr 14, 2005)

Looks like they got your probelm under control over at the DosTips.com forums.


----------



## AceInfinity (Jan 21, 2012)

Automation for a script to run at specific times cannot be done within the batch file, you can probably use the system task scheduler to do that.

Otherwise, this works, you didn't need the quotes...


```
set timestmp=%date%-%time%
echo files moving at %timestmp: =% >> C:\OutputFile.log
move "C:\A\*.*" "C:\Test" >> C:\OutputFile.log
move "C:\B\*.*" "C:\Test" >> C:\OutputFile.log
echo files moved at %timestmp: =% >> c:\outputfile.log
```
Enjoy


----------

