|
Answer» Hello,
Can anyone help me with getting the full path when one of the directories has a space in it?
I.e.
Dir STRUCTURE: c:\test c:\test\new stuff c:\test\new_stuff
Batch File: (snippet) FOR /R %%A in (*.security) do CALL :IndexAdd %%A
:IndexAdd SET FNAME=%~nx1 SET fPath=%~dp1 ECHO Indexing file: %fPath%%fName%
This seems to work fine, until I hit a directory with a space in the name, when it has a space it truncates at the space and then the filename and path are incorrect.
I tired ADDING the delims= with different characters, but when I do it doesnt FIND anything at all...
Thanks for any help.
Brock
Code: [Select]FOR /f "tokens=* delims=" %%A in ('dir *.security /s /b') do CALL :IndexAdd "%%A"
:IndexAdd SET fName=%~nx1 SET fPath=%~dp1 ECHO Indexing file: %fPath%%fName%
The R switch in the for command does not ALLOW the use of the tokens and delims options. A workaround is to build a better mouse trap.
|