I have an array of filenames and I wish to print the file's name of each one:
For example: if the array contains the file: C:\Windows\Directx.log Then, I would like to print Directx.log
I know that if I iterate on a text file, I can do it like this:
for %%F in ("C:\Documents and Settings\Usuario\Escritorio\hello\test.txt") do echo %%~nxF
But again, it's an array and not a text file.
Here's my code:
set filesCount=0
for /f "eol=: delims=" %%F in ('dir /b /s %SequencesDir%\*.%StandardExtension%') do (
set "filesArray!filesCount!=%%F"
set /a filesCount+=1
)
set /a secondCnt=0
:LoopArray
if not %secondCnt%==%filesCount% (
set CurrentFile=!filesArray%secondCnt%!
echo !CurrentFile!
for /f "delims=" %%A in ('echo(%CurrentFile:\=^&echo(%') do set ExactFile=%%~nxA
echo %ExactFile%
set /a secondCnt+=1
goto LoopArray
)
Any ideas?