To open multiple folders using batch script

Closed
Shri - Jul 12, 2012 at 12:54 AM
 shmuel - Jul 15, 2012 at 05:16 AM
Hello,

i would like to know how to read multiple folders using batch script and copy the same into another folder.
eg:
E:\CDR\June2012\a.txt
E:\CDR\July2012\b.txt
E:\CDR\August2012\c.txt

The batch script should be able to read the .txt files one by by from the respective folder and copy the same to another folder say for eg: E:\WorkingFolder\something.txt

Kindly provide your suggestions on this.

Thanks
Shriram

4 responses

Hello,

Kindly help with your sugestions.

Thanks
Shriram
0
I think you mean copy the contents of two or more files into one text file (not folder).

Here's a better place to ask for this type of help.
http://www.donationcoder.com/forum/index.php?board=71.0
This is a place where you can ask programmers to make small programs for you or help you with small coding projects.

I could help you with that with an AutoIt script, but not a batch file. are you interested in an AutoIt script?
0
Hi,
Thanks for your reply.
Would be interested if the same could be accomplished with an AutoIt script.
Please help with one for this requirement.

Thanks
Shriram
0
The script is below. Go here and install AutoIt:
http://www.autoitscript.com/site/autoit/downloads/
Then copy the text below to a blank text file and save it with a .au3 extension.
Double-click the file to run it.

; This script adds the contents of two more text files to one output file.
; Edit the $outputFile name (and path) and all $inputFile names

Dim $inputFile[10]
Dim $outputFile = "C:\Users\sampleUser\Desktop\Output.txt" 
Dim $text[10]
Dim $x

$inputFile[0] = "C:\Users\sampleUser\Desktop\sample file.txt"
$inputFile[1] = "C:\Users\sampleUser\Desktop\sample program.c"
$inputFile[2] = ""
$inputFile[3] = ""
$inputFile[4] = ""
$inputFile[5] = ""
$inputFile[6] = ""
$inputFile[7] = ""
$inputFile[8] = ""
$inputFile[9] = ""

For $x = 0 to 9
	FileOpen($inputFile[$x])
	$text[$x] = FileRead($inputFile[$x])
	FileClose($inputFile[$x])
Next

FileOpen($outputFile, 1)
For $x = 0 to 9
	FileWrite($outputFile, $text[$x] & @CRLF)
Next
FileClose($outputFile)
0