In Windows, a batch file with a recursive for loop and a file name including blanks
How about this?
for /f "tokens=* delims=" %%a in ('dir "c:\test\foo bar.txt" /s /b') do (
echo %%a
)
Without the recursive switch, you can tell FOR
not to print the quotes:
for %%f in ("foo bar.txt") do @if exist %%f echo %~dpnxf
You might be able to do nested FOR
statements. The outer would walk the directory tree and the inner would be the one above.