Search found 4036 matches

by Squashman
04 Jan 2012 15:03
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

Something different. @echo off ::Determine file size set "fSize=%~z1" for /f "delims=" %%a in ('findstr /n . "%~1" ^|findstr "^1:"') do call :strlen "%%~a" len & goto :break :break for /f "tokens=2 delims=:" %%L in ('findstr /n /o "...
by Squashman
04 Jan 2012 12:51
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

OK - I've got the ultimate text file attribute probe It measures everything directly - it does not do any math based on assumptions. It is able to process a 250MB file in 16 seconds. Ok your computer must be exponentially faster than mine. 30 seconds each. E:\batch files\HEAD>FileAttributes.bat EOF...
by Squashman
04 Jan 2012 12:30
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

Some more output using EOF this time. This one seems to be OK with the LF and an EOF. My biggest concern was that it took close to 20 seconds for each of these two tests. But overall this should still be quicker than using FIND. E:\batch files\HEAD>DaveLength.bat EOF_CRLF.txt fSize=63016885 lnCnt=25...
by Squashman
04 Jan 2012 11:57
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

Here is some output. Using the Same input file. One with CRLF and one with just an LF. I am getting the output that I really need, but not sure why the last two variables come back as undefined when the file has a LF for the EOL. Getting back the correct Line Count, Line Length and EOL Size is reall...
by Squashman
04 Jan 2012 11:26
Forum: DOS Batch Forum
Topic: Saving progress/game
Replies: 5
Views: 2047

Re: Saving progress/game

Code: Select all

 FOR /F "tokens=1,2 delims==" %%I in (Gamesettings.txt) DO IF "%%I"=="Level" GOTO Level%%J
by Squashman
04 Jan 2012 07:34
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

I gave it a try with a very small file (in my world) of 25,012 lines and a line length of 1026. I ran it with an EOL of LF and received the ERROR: Invalid file format. I then ran the file through an EOL Converter and changed the EOL to CRLF. Ran the batch file again and received the same ERROR: Inva...
by Squashman
04 Jan 2012 06:36
Forum: DOS Batch Forum
Topic: delete 2 days older folders
Replies: 18
Views: 7571

Re: delete 2 days older folders

1. m - D-daY 100% calculation 2. m - week Mon Tue Wed Thu Fri Sat Sun file make day - to 2 week day today monday - 2day = satday max day 6day delete 3. windows server type command 2 line command end @echo off FORFILES /D -2 /m filesname exsemple forfiles /P D:\backup\WEB_SOURCE\2010\ /D -7 /C "...
by Squashman
03 Jan 2012 22:13
Forum: DOS Batch Forum
Topic: A dos version of unix which command
Replies: 13
Views: 5996

Re: A dos version of unix which command

That is precisely the expected behavior. The whole point is to determine what will be executed if an attempt is made to invoke a given executable such as "notepad" from the current directory. I suppose that does make sense. For some reason I was thinking he did want to find the paths to a...
by Squashman
03 Jan 2012 22:03
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

Hi Dave, I will give this a try at work tomorrow. Lots of code to look at and I wan't to make sure I understand it. I was just thinking about using the Modulus to figure out if the record length is correct. set /A numlines=%filesize%%%%(%linelength%+2) example: set /A temp=100000%(998+2) This would ...
by Squashman
03 Jan 2012 21:28
Forum: DOS Batch Forum
Topic: create dir with text file in it
Replies: 3
Views: 2053

Re: create dir with text file in it

I believe they want the XML code written to the file %%L\%%L.DVD.DISC
by Squashman
03 Jan 2012 21:20
Forum: DOS Batch Forum
Topic: A dos version of unix which command
Replies: 13
Views: 5996

Re: A dos version of unix which command

Shouldn't this code find the file in all directories within your path? It only seems to find it in the first directory within the path. @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION SET NAMEEXT=!PATHEXT:.=%1.! FOR %%N IN (%NAMEEXT%) DO IF NOT "%%~$PATH:N" == "" ECHO %%~$PATH:N Notep...
by Squashman
03 Jan 2012 21:00
Forum: DOS Batch Forum
Topic: A dos version of unix which command
Replies: 13
Views: 5996

Re: A dos version of unix which command

I have always been partial to WHEREIS
by Squashman
03 Jan 2012 13:59
Forum: DOS Batch Forum
Topic: Determining the number of lines in a file.
Replies: 50
Views: 19972

Re: Determining the number of lines in a file.

Getting a little further along now that I am at work I am now testing with a file of 1026 bytes and it seems to work regardless of the EOL being a CRLF or just a LF. Problem is I am never stripping the Number and Colon that the FINDSTR command adds yet my length count comes out to 1026. I have no cl...
by Squashman
03 Jan 2012 11:49
Forum: DOS Batch Forum
Topic: A dos version of unix which command
Replies: 13
Views: 5996

Re: A dos version of unix which command

Not sure why I did that first set statement. You can do the string replacement in the FOR LOOP.

Code: Select all

FOR %%a in (%PATHEXT:;= %) do call :function "%~1%%~a"
by Squashman
03 Jan 2012 11:40
Forum: DOS Batch Forum
Topic: List Directory with time stamp
Replies: 2
Views: 1671

Re: List Directory with time stamp

Code: Select all

for /f "tokens=*" %%I in ('dir /a-d /b /s *.xls') do echo %%~dpnxI,%%~tI >>filelist.csv