Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: pball
I get files often that have a crc checksum in the file name but no premade sfv to check it with. So I run the file through quicksfv and open the sfv file and compare the value in the file name and the actual crc after it. If they match the file is complete.
I would like a batch file to search a sfv file and find the two crc numbers in each line and compare them if they are the same it goes on if not it would echo the whole line it was working on.
This is an example line in the file.
[a-s]_yu_yu_hakusho_001_-_surprised_to_be_dead__[ma]debito_dvd-rip__[8CBE991C].ogm 8CBE991C
The listed crc is inside of the [] brackets and the actual crc is one space behind the file name. The ext and everything after the [ bracket should be constant, as in the number of characters won't change. If that would help any.
I do not know how to search and return text which I assume would be a good wat to do this.
I would think a quick and dirty way of doing this would be to find the [ then set everything behind it to a variable then compare the 1st-8th characters from the variable to 14th-22nd characters
can't find any good thread on finding things in a txt file or i'd cobble something together first then ask for help.

so in the above example whaat would you want to extract?
I only Batch if possible, 2000 more lines of code, oh well.

Well to put it simply I want to compare 8CBE991C and 8CBE991C (which are the same at this time).
If your talking about my harebrained idea it would be setting this 8CBE991C].ogm 8CBE991C (everything after the [) to a var then I could use what i know know to get parts of that variable.
EDIT
I just remembered something that might help, it's something someone made for me before for something else.call :parse %%x
:parse
SET element=%1
IF "%element%"=="%element:~-3%" IF "%element:~0,1%"=="T" (SET num=%element:~-2%& GOTO :EOF)
IF NOT "%title%"=="" (SET title=%title% %1) ELSE SET title=%1
SHIFT
GOTO parseThis was made to get the two characters after the letter T. I have no clue how it works, but I think this could be reworded into finding the [ and setting the rest of the line to what's behind it instead of the next two characters.
link to that thread
http://www.computing.net/answers/pr...

Well a new post since I made something that works almost.
Only problem is it's case sensitive.not any more
@echo offsetlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%x in ("E:\Anime\Yu Yu Hakusho\[a-s]_yu_yu_hakusho_001_-_surprised_to_be_dead__[ma]debito_dvd-rip__[8CBE991C].sfv") do (
call :check %%x
if /I not "!z:~0,8!" == "!z:~14,22!" echo %%x
set z=
)goto end
:check
set x= %1 %2
:againif "%x:~-1%" == "[" set s=%z% & goto :EOF
set z=%x:~-1%%z%
set x=%x:~0,-1%
goto again
:end
pausecouple of questions:
how can I get it to find any sfv file in the folder it's ran in? so i don't need to add the name there.

Untested, and it'll break if the file name has spaces:
@FOR /F "tokens=1,2" %%a IN (*.sfv) DO @(ECHO %%a | FIND "%%b" >NUL || ECHO %%a)
Command Scripts don't do logic well, so it's best to keep it simple.

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

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