PC Review


Reply
Thread Tools Rate Thread

Batch if then

 
 
joshboski
Guest
Posts: n/a
 
      5th Jun 2008
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>
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      5th Jun 2008

"joshboski" <(E-Mail Removed)> wrote in message
news:0f58fd33-8124-4975-9451-(E-Mail Removed)...
>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.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A script/batch to kill a batch file from scheduled tasks? Bogdan Windows XP Configuration 1 31st Jul 2009 06:05 AM
batch file call from a macro - how ? and required batch format VB-rookie Microsoft Excel Programming 3 5th Sep 2008 10:33 PM
calling multiple batch files from within a batch file yawnmoth Windows XP General 3 26th May 2008 06:47 PM
Save batch window msgs to a file from the batch prog Stephen Rainey Windows XP General 3 10th Jan 2007 12:50 AM
Photo Editor Batch supporting batch compression JPG files 29150 Freeware 2 23rd Jun 2003 06:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:21 PM.