Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Sir
Daily various files are created in various directories on D drive of my windows 2003 server. In E drive, daily a sub-directory gets created with System date (ddmmyy) as its name. How to copy/move files from different folders in D drive to the Systemdate directory of E drive. Please help me with a batch file for automating this work.

Please tell us what type of files gets
created, and we can help in creating batch
file for you.you can always use windows task scheduler to schedule running your scripts.

Thanks for coming to my rescue at short notice.
Forgive me,at the cost of your time, I will explain in detail my requirement.
In Win 2003 server D and E drives are available. On running an application, various reports get generated, whose suffix would be *.001, *.002 *.003 ...... say upto *.948. All files contain some reports and some statement like matter.
The E drive will contain a directory tree such as MIC/001/..../..../..../101008 and MIC/002/.../.../..../101008 like that for all 948. Here 101008 is the directory created on a daily basis by the scheduler. 001 is the folder, to which the report with corresponding *.extn is related. That is,if the file in D drive's folder is Rpt.001 it should be moved to E drives MIC\001\...\...\...\101008 (Since the batch file to move the file is run on 10th Oct. it should naturally go to 101008 folder.
I hope I have not further confused.

I think this will give you an idea on where you can start, I'm not sure how to get the %date% to be displayed in your format, I'm not very good at scripting . .
can anyone help us with this ..
++++++ Open for development +++++++
Feel free to develop .. thanks ..
======== Batch ==========
@echo off
rem This is a simple migration script
ECHO Files getting copy please standby...
ECHO.
ECHO Creating Log directory on your Desktop.
rem This will check if backup directory
exsist if it not
IF EXIST E:\MIC GOTO Backup
IF NOT EXIST E:\MIC GOTO NOTFOUND:Backup
xcopy D:\*.??? E:\MIC\%date%
IF ERRORLEVEL 0 GOTO Results1
IF ERRORLEVEL 1 GOTO Results2:NOTFOUND
Backup directory not found !! Please check:Results1
@echo OFF
echo directory created successfully.
GOTO Pingall:Results2
@echo OFF
echo.
echo directory creation failed.
pause====================================

Sir
%date% will create a date directory dd-mm-yyyy or as per local regional/date settings.Here my case is the date directory is already created by the scheduler during midnight.
Only I need to move the files from D to E\MIC\001\...\ddmmyy directory. The files in D drive with 001, 002, etc will have to be moved to the corresponding E\MIC\???\...\ddmmyy (the System Date Directory).
To be more precise D:\001\dt.001 will move to E:\MIC\001\...\101008 and D:\002\dt.002 will move to E:\MIC\002\...\101008 and D:\003\dt.003 will move to E:\MIC\003\...\101008 like that.
I am totally new to the scripting. Pl. help me.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |