Search found 345 matches

by Samir
07 Nov 2015 11:23
Forum: DOS Batch Forum
Topic: Help needed with forfiles.
Replies: 3
Views: 1172

Re: Help needed with forfiles.

No need to use FORFILES. A normal FOR command will be just fine. @ECHO OFF FOR %%G in (*.x3f) DO ( x3f_extract -wb Daylight "%%G" exiftool -TagsFromFile "%%G" "-all:all>all:all" "%%G.dng" ) That's what I was thinking too. I was also trying to think of a way t...
by Samir
07 Nov 2015 11:16
Forum: DOS Batch Forum
Topic: Search for String
Replies: 15
Views: 3455

Re: Search for String

If my aging memory serves me correctly I remember Dave doing some testing on this streaming trick. He was specifically testing what was the fastest way to count the number of lines in the file. I can't remember if the FIND or FINDSTR command was faster. I suppose I could test when I get back to wor...
by Samir
07 Nov 2015 11:13
Forum: DOS Batch Forum
Topic: Changing date from MM/DD/YY to MM/DD/YYYY format
Replies: 4
Views: 1624

Re: Changing date from MM/DD/YY to MM/DD/YYYY format

I have a batch that has a similar requirement. The easiest thing I found was to just use the replace.bat available here and run it on the output file to change the years that way. The only thing you have to watch for is what you specify in the replace as it will also replace dates if you don't have ...
by Samir
07 Nov 2015 10:04
Forum: DOS Batch Forum
Topic: Conditional Actions Using Data From Text File
Replies: 20
Views: 4703

Re: Conditional Actions Using Data From Text File

That's the kind of Input that I tried to process: Credit Batch 014 Summary Third token is 014 that I thought should be interpreted as 14. Since a prepended 0 marks it as octal number i tried to get rid of it by catenating 1000 and modulus 1000 afterwards. There is no floating point number in your e...
by Samir
07 Nov 2015 09:48
Forum: DOS Batch Forum
Topic: Stackoverflow
Replies: 43
Views: 7474

Re: Stackoverflow

Sorry to say that but such a discussion is totally meaningless in a Batch forum like this. No one of the responsibles at SO will ever read your complaints here. If you're dissatisfied you should rather tell it to the administration of SO. How should they become aware of it otherwise? And if you're ...
by Samir
06 Nov 2015 23:16
Forum: DOS Batch Forum
Topic: Stackoverflow
Replies: 43
Views: 7474

Re: Stackoverflow

Squashman wrote:So apparently you can delete a question even after someone worked hard providing an answer for you. That is just not cool.
That's some seriously bad moderation. It's a slap in the face to the creator of the content. I actually refuse to post on sites that do that--it's a waste of my time.
by Samir
04 Nov 2015 21:16
Forum: DOS Batch Forum
Topic: Conditional Actions Using Data From Text File
Replies: 20
Views: 4703

Re: Conditional Actions Using Data From Text File

Something is not right. :(

Even with the original code, I'm not getting the right output for problems.txt. I'm not sure about sum since it truncates floating point numbers.

I'll see if I can't post some more details when I get some time. :(
by Samir
04 Nov 2015 13:12
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

Squashman wrote:
Samir wrote:When did this feature in dir come about? I know it wasn't there in the dos 6.0 days. Did it start in win95? Or was it with win2k or xp?

I would assume Windows NT.
I'll have to try it on my NT system. Thank you!
by Samir
04 Nov 2015 11:22
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

I checked the help on DIR and didn't see it, Well there is no concrete example showing it but the help file does use the plural of the word file. [drive:][path][filename] Specifies drive, directory, and/or files to list. I always thought of 'files' as just the normal list of files. When did this fe...
by Samir
04 Nov 2015 11:20
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

I'm a bit unsure, because of the question mark in "%%~a.%%~b?": When writing the code I was trying to use a dir command and filter the full list using the %currentdate% variable with findstr so the list is only retrieved once (a dir command with several masks execute several searchs, so I...
by Samir
04 Nov 2015 09:42
Forum: DOS Batch Forum
Topic: Conditional Actions Using Data From Text File
Replies: 20
Views: 4703

Re: Conditional Actions Using Data From Text File

It took me a bit to understand the algorithm in your code, but I think I got it now. I plan to use this code to get the filenames that are needed to be parsed: FOR /F "tokens=1-5" %a in ('dir bat*.rpt /a-d^|findstr /c:"%currentDate%"') do How would I incorporate this into the cod...
by Samir
03 Nov 2015 22:47
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

Squashman wrote:You can do multiple file masks with the DIR command.
I checked the help on DIR and didn't see it, but tried and you're absolutely right! Learned something big today! Thank you! I'll see how I can best incorporate this. Probably won't change speed, but definitely will make the code easier to read.
by Samir
03 Nov 2015 17:08
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

If you differ between the filetypes, then you probably could simplify to: FOR %%F IN (DAY PLU SKU ) DO for /f "tokens=1,2 eol=|" %%a in (' dir %%F*.rpt /a-d /-n /o-d ^| findstr /c:"%currentDate%" ') do set "%%~F=%%~a.%%~b" I'm a bit unsure, because of the question mark...
by Samir
03 Nov 2015 16:39
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

I've been able to tweak this even a bit more to make it execute almost instantly now. :REPORTSTART setlocal enableextensions enabledelayedexpansion FOR %%F IN (DAY PLU SKU) DO ( for /f "tokens=1,2 eol=|" %%a in (' dir %%F*.rpt /a-d /-n /o-d ^| findstr /c:"%currentDate%" ') do for...
by Samir
03 Nov 2015 15:07
Forum: DOS Batch Forum
Topic: Optimizing These Loops
Replies: 31
Views: 5159

Re: Optimizing These Loops

If your system has short names enabled, then you could try this @echo off setlocal enableextensions enabledelayedexpansion set "currentdate=11/03/2015" for /f "tokens=1,2 eol=|" %%a in (' dir *.rpt /a-d /-n ^| findstr /c:"%currentdate%" ') do for %%c in ("%%~a.%%~...