
July 28th, 2009, 05:38 AM
|
 |
Contributing User
|
|
|
|
Quote: | Originally Posted by xterm11 How can I copy a file into an unknown child directory?
For example:
MainFolder
|
|--Folder1 |
|--Folder2
| |
| |--Where Log.txt should be copied to
|
|--Folder3
| |
| |--Where Log.txt should be copied to
|
|--Example.bat
|
|--Log.txt
In the above example file tree, I want "Example.bat" to copy "Log.txt" into all of the children("Folder2" and "Folder3") of the file Example.bat is located in(Folder1). The problem is that I don't know the name of Folder1, Folder2, or Folder3.
So in this example I would need "Example.bat" to copy "Log.txt" into "Folder2" and "Folder3".
The only way I can think of doing this is to use something like DIR (Which shows all folders and files in the current folder you run your batch in), and the wild card symbol(*).
I know how to copy into a parent directory:
But, I have no clue how to copy into a child directory. Thanks in advance for help,
Xterm11 |
I think this one can help you:
http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html
What you are trying to accomplish is something a bit complicated, you can run maybe an IF command using batch file, but since you do not know the names of those child directories, maybe to avoid some error you can test them first if it did exist in the first place. Hope this helps.
|