Batch if then

J

joshboski

I need to some how check these drives and delete files off of them but
somehow it will not skip N which is a drive I do not want to delete
from
<quote/>
@echo off
FOR /F "tokens=1,2 delims=\ " %%A IN ('FSUTIL FSINFO DRIVES ^| MORE /
E /T0') DO (
REM Skip N:
IF "%%A"=="N" (
echo "skipping N"
) else (
echo "Deleting files from %%A"
del /S "%%A%\FILE1"
)
)
</quote>
 
P

Pegasus \(MVP\)

joshboski said:
I need to some how check these drives and delete files off of them but
somehow it will not skip N which is a drive I do not want to delete
from
<quote/>
@echo off
FOR /F "tokens=1,2 delims=\ " %%A IN ('FSUTIL FSINFO DRIVES ^| MORE /
E /T0') DO (
REM Skip N:
IF "%%A"=="N" (
echo "skipping N"
) else (
echo "Deleting files from %%A"
del /S "%%A%\FILE1"
)
)
</quote>

Replacing
IF "%%A"=="N" ( with
IF "%%A"=="N:" (
might help . . .

Having "@echo on" as the first line will make this type
of error glaringly obvious.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top