This is an attempt at sorting unknown files into unknown directories by listing each directory's content into a list (placed in each directory). A single new file %filename%
is divided into words (by spaces) and those words are used to search the file databases keywords.txt
in each directory. I am supposed to count these hits together to figure out where the file belongs, but my counting system does not work at all.
set "count="
:: feed a list of all subdirectories
for /f "delims=" %%i in ('dir /s /b /a:d') do (
rem reset keywords, then rebuild
echo. >"%%~i\keywords.txt" & for /f "delims=" %%a in ('dir "%%~i\*.*" /b /a:-d') do echo %%~na >>"%%~i\keywords.txt"
@echo on
for %%a in (%filename%) do find /i /c "%%a" "%%~i\keywords.txt" && set count+=1
@echo off
echo count is %count%
)
one clue might be that the last line produces no %count%
, just count is