Search found 160 matches

by MKANET
06 Apr 2012 20:03
Forum: DOS Batch Forum
Topic: Pulling information from a text file using for /f
Replies: 5
Views: 3855

Pulling information from a text file using for /f

I need to ultimately end up with two variables in each for /f loop s%% (first token in each line) t%% (everything after the first delimiter) ----------- text.txt -------------- S8F1TR4 Westwood CA 8F1 S86cTR4 Crenshaw 026 S8BDTR4 Inglewood CA 971 S8AFTR4 Tri Counties ADO CA H89 S8CATR4 Thousand Oaks...
by MKANET
02 Apr 2012 20:56
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Re: Copy the last 7 written *.txt files in a directory

Worked like a charm... setlocal enabledelayedexpansion was missing for the counter to work.

I appreciate all your time and effort!
by MKANET
02 Apr 2012 20:35
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Re: Copy the last 7 written *.txt files in a directory

Thanks, but I'm trying to do this without deleting the source files. Copying the entire directory contents to another location just to delete most of them doesnt sound very practical. I have to toy with a script right now, but can't get the counter to work. It's supposed to pipe the names of the 7 m...
by MKANET
02 Apr 2012 19:26
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Re: Copy the last 7 written *.txt files in a directory

If it were that easy, I wouldn't be posting here. I don't mind if the batch file takes a a little longer to process the files for comparison. Typical file name is: BK120320-002.txt (created by backup software). Unfortunately, I can't change the configuration of all our backup servers enterprise-wide...
by MKANET
02 Apr 2012 18:59
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Re: Copy the last 7 written *.txt files in a directory

Only whats available in a dir command on Vista/Win7 command-line.

Edit: I know it can be done with the combination of a dir command piped to a for /f command; just not sure how without giving myself a headache :)
by MKANET
02 Apr 2012 18:36
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Re: Copy the last 7 written *.txt files in a directory

It varies, anywhere from none to 4-5.
by MKANET
02 Apr 2012 16:29
Forum: DOS Batch Forum
Topic: Copy the last 7 written *.txt files in a directory
Replies: 12
Views: 7445

Copy the last 7 written *.txt files in a directory

I tried using: robocopy "%newremote%" "%home%\Today" BK*.txt /maxage:7 However, it looks like it just copies only the last seven days. I need a way to copy the last seven day's that were written in the directory. So, if the oldest file is from the end of January, it would copy ev...
by MKANET
02 Apr 2012 16:24
Forum: DOS Batch Forum
Topic: A clever way to embed a entir text file within a batch file?
Replies: 10
Views: 14112

Re: A clever way to embed a entir text file within a batch f

Wow thanks for all the replies. I couldn't have done it without you guys!
by MKANET
31 Mar 2012 21:42
Forum: DOS Batch Forum
Topic: A clever way to embed a entir text file within a batch file?
Replies: 10
Views: 14112

A clever way to embed a entir text file within a batch file?

My batch file depends on an xsl stylesheet. I would like to include the entire contents of the xsl file within my batch file; and, create the xsl file when necessary via the batch file. I need to have it self contained. Is this possible? I've seen instances where the entire contents of a text file i...