Solved Choose a Directory Using Batch File

January 11, 2013 at 13:45:41
Specs: Windows XP
I have output files in the below directories



The input to the bat script will be source (C:\Archive\)and destination dir.

In the bat script first we have to ask the user to select a run_date under C:\Archive\ then we have to move all the files under the above directories into destination directory

See More: Choose a Directory Using Batch File

Report •

January 11, 2013 at 18:39:58
First you need to tell us the format of the run date... In this case I will assume its only numerical.

Set /p rundate="Please enter a run date in the format mmddyyyy. :"

Then change <run_date> to %rundate%

I would advise insuring that the date format matches. Then do a test run.

:: mike

Report •

January 14, 2013 at 08:00:51
Thanks for the prompt response..How to change <run_date> to %rundate%after getting the %rundate%, is it possble to move all the files under directories and subdirectories into destination folder or again we have to use for loop to move each file at a time

Report •

January 14, 2013 at 08:53:42
✔ Best Answer
You could probably use xcopy if you don't want to use a for statement

Xcopy c:\Archive\%rundate%\Broker_A\ c:\newfile /I

I would test first as always

:: mike

Report •

Related Solutions

January 14, 2013 at 09:51:09
I tried that, its working fine..but

Is there any command like below(To copy files under all directories c:\Archive\%rundate%\*) ???

copy or Xcopy c:\Archive\%rundate%\*\*.txt Destfolder

Report •

Ask Question