|
Answer» I have a structure of folders that follows the below example:
Main | -------- Susan | | | -------- Folder1 | | | -------- Folder2 | -------- George | -------- Folder1 | -------- Folder2
Each folder has a .TXT document that I need to then read from to get certain information from. I want to create a Batch PROGRAM to prompt me (or the user) to flow through the folder structure, and when it gets to the last folder it'll pull the information from the .TXT file.
Example:
Prompt: 1-Sue, 2-George? ...I input 2 Prompt: 1-Folder1, 2-Folder2? ...I input 1 the program then reads the .TXT file inside ..\Main\George\Folder1\text.txt
It's possible to have up to 3 folder tiers (..\Main\Folder1\Folder2\Folder3\text.txt), but I need the system to automatically pull up the next folder I have in the system and give me the choice to open from it. Can SOMEONE help me create this batch file? I'm not quite sure where to start from.
Thanks.PLEASE clarify a bit.... so do you want all the text documents to merge into one at main or do you want them all to be moved into a folder at main. I don't understand... please help 1. You are in the top folder you call "Main"
2. Echo "Txt files found"
3. use set /a to make a variable equal to 1
4. A FOR loop captures the output of dir /b /s *.txt & assigns each FILENAME in turn to the loop variable
5. In the loop:
display the variable value and folder name 1 to a line add 1 to the variable after doing this
1 Susan\Folder1\textfile.txt 2 Susan\Folder1\Folder2\textfile.txt 3 George\Folder1\textfile.txt 4 George\Folder2\textfile.txt 5 George\Folder1\Folder2\Folder3\textfile.txt etc
6. Echo "type a number"
6. Use set /p to get the user's choice
Again,
7. use set /a to make a variable equal to 1
8. A FOR loop captures the output of dir /b /s *.txt & assigns each path + filename in turn to the loop variable
9. In the loop: add 1 to the variable each time around 10. When variable equals choice set a variable equal to current found path + filename quit the loop
11 You have the path to your desired file
5. Use set /p to ask the use for their choice
Another loop as 3 & 4 above
|