Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Dear All,
I have a setup which requires me to remove 2 files from 20 folders every day and let them get regenerated each morning. After the month-end I need to merge them all together.
My files are in the following location:
\\server\survey\a\1.txt
\\server\survey\a\2.txt
\\server\survey\b\1.txt
\\server\survey\b\2.txtetc.
I need 1.txt and 2.txt at O:\survey\%date%\
Is there an easy way to do this? And yes, 1.txt and 2.txt files should be merged while being copied there.
Thanks for any help, I am trying to do this with a batch but it would not take the wildcards.
Ben

For starters, you won't have much luck with a dir named %date% as it will often contain illegal chars; / \ : to mention a few.
Beyond that, do you want to merge al the 1.txt and merge all the 2.txt separately or all 1s and 2s together?
=====================================
If at first you don't succeed, you're about average.M2

Hi thanks for picking this up.
The %date% is set up to produce a DD-MM-YYYY string, no illegal characters there. I use this variable in many of my scripts.
All the 1.txt's should go to one file and the 2.txt's into another file, producing 2 files all together at the end.
Thanks a lot,
Ben

:: merhe all 1.txt and 2.txt
:: not tested ; I don't have a network@echo off & setLocal EnableDelayedExpansion
pushd \\server\survey
for /L %%a in (a b c d) do (
type %%a\1.txt >> O:\survey\%date%\1.txt
type %%a\2.txt >> O:\survey\%date%\2.txt
)
=====================================
If at first you don't succeed, you're about average.M2

Hi,
Unfortunately this does not work, it ends up in a continuous loop, dont know why. I am going to write the script manually, there will be 40 lines but still doable.
Thanks a lot,
Ben

![]() |
![]() |
![]() |

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