Computing.Net > Forums > Programming > batch file help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch file help

Reply to Message Icon

Name: chssastry
Date: October 9, 2008 at 02:34:39 Pacific
OS: windows 2003
CPU/Ram: hp
Product: chssastry
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: amlife
Date: October 9, 2008 at 07:24:19 Pacific
Reply:

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.


0

Response Number 2
Name: chssastry
Date: October 10, 2008 at 06:15:41 Pacific
Reply:

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.


0

Response Number 3
Name: amlife
Date: October 10, 2008 at 11:53:01 Pacific
Reply:

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

====================================


0

Response Number 4
Name: chssastry
Date: October 10, 2008 at 22:05:39 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch file help

batch file help www.computing.net/answers/programming/batch-file-help/13830.html

Batch File Help www.computing.net/answers/programming/batch-file-help-/11464.html

batch file help www.computing.net/answers/programming/batch-file-help/190.html