|
Answer» I'm trying to merge two files together one of which has date-time as part of the name. I want the resulting file name to be the second listed file (the one with the date/time) of my copy statement. For INSTANCE given these files: c.txt abc20050509-083222.txt
using something similar to: copy c:\x.txt+c:\abc*.txt d:\abc*.txt
I want the resulting file on the d: drive to be abc20050509-083222.txt. Is this possible? Meant to say given x.txt instead of c.txt in description.There is a QUIRK in the COPY command that if you leave out the target filename, all the data will end up in FIRST source filename. However this does not work with wildcards.
copy c:\x.txt+c:\abc20050509-083222.txt will put all the data from both files in x.txt. If sequence is important then this method may not be helpful.
A datetime stamp is a moving target. If the VARIABLES you used to generate the datetime stamp are still available you could use them in the copy statement.
You could prompt for the filename (set /P) or maybe you could key off a dir list and pull a substring from the filename. This last suggestion could be really ugly.
Hope this helps. Thanks for suggestions. I was hoping that I was just missing something simple but looks like what I was trying to do is just more difficult in DOS.
|