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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

IF Exists with wildcards?

Reply to Message Icon

Name: jaydenjamar
Date: May 11, 2007 at 12:27:07 Pacific
OS: XP/2003/2000
CPU/Ram: Intel Core Duo 2.4
Product: 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?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 11, 2007 at 12:33:25 Pacific
Reply:

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



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

M2



0

Response Number 2
Name: jaydenjamar
Date: May 11, 2007 at 14:00:53 Pacific
Reply:

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


0

Response Number 3
Name: Mechanix2Go
Date: May 11, 2007 at 14:58:53 Pacific
Reply:

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



0

Response Number 4
Name: jaydenjamar
Date: May 11, 2007 at 15:58:53 Pacific
Reply:

Looks like its working. Thanks for your help!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


delete a repeated string ... Rename file to system dat...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: IF Exists with wildcards?

Batch For DO(list of if exist set)? www.computing.net/answers/programming/batch-for-dolist-of-if-exist-set/16087.html

C++ if exist www.computing.net/answers/programming/c-if-exist/12105.html

Loopinig batch file using IF EXIST www.computing.net/answers/programming/loopinig-batch-file-using-if-exist/17323.html