Computing.Net > Forums > Programming > IF Exists with wildcards?

IF Exists with wildcards?

Reply to Message Icon

Original Message
Name: jaydenjamar
Date: May 11, 2007 at 12:27:07 Pacific
Subject: IF Exists with wildcards?
OS: XP/2003/2000
CPU/Ram: Intel Core Duo 2.4
Model/Manufacturer: Home Made
Comment:

I have been writing a batch script that needs to check for the existence of a file and do some action, however the filenames changes daily. I was going use the IF Exist command with *.txt or whatver the extension is, but IF Exist does not support wildcards. Anyone know a way to use IF Exist with wildcards or some other mehtod?


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: May 11, 2007 at 12:33:25 Pacific
Subject: IF Exists with wildcards?
Reply: (edit)

It DOES
================
C:\temp>if exist *.bat echo y
y



=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: jaydenjamar
Date: May 11, 2007 at 14:00:53 Pacific
Subject: IF Exists with wildcards?
Reply: (edit)

thanks mechanix, this might work for me.. Any other ideas are still welcome..


Report Offensive Follow Up For Removal

Response Number 3
Name: Mechanix2Go
Date: May 11, 2007 at 14:58:53 Pacific
Subject: IF Exists with wildcards?
Reply: (edit)

If you code is failing to brach, maybe it's some other problem. You can post your code.


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 4
Name: jaydenjamar
Date: May 11, 2007 at 15:58:53 Pacific
Subject: IF Exists with wildcards?
Reply: (edit)

Looks like its working. Thanks for your help!


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: IF Exists with wildcards?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge