comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Checking the existence of a file with only part of the file's name
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Checking the existence of a file with only part of the file's name [message #94598] Wed, 19 July 2017 09:07 Go to next message
thtran296 is currently offline  thtran296
Messages: 8
Registered: June 2017
Junior Member
Hello everybody,

So I have thousands of text files, with the names like "textABC05_023.tab"
I want to check if one of these files exists. So I use the following:

result = file_test('Documents/DataFile/textABC05_023.tab') & print, result

The problem is, this only works if I know the exact full name of the file. What if I only want to check the existence of files, given that I know only part of the name, like "textABC05" (omitting the "_023" part)?

Part of the reasons I want to do that is these files have really random numbers at the end, and all I care is whether their names match up to the part textABC05, and if they did, then they exist.

Thank you for all your assistance.
Re: Checking the existence of a file with only part of the file's name [message #94599 is a reply to message #94598] Wed, 19 July 2017 10:51 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Wednesday, July 19, 2017 at 12:07:44 PM UTC-4, thtr...@gmail.com wrote:
...
> The problem is, this only works if I know the exact full name of the file. What if I only want to check the existence of files, given that I know only part of the name, like "textABC05" (omitting the "_023" part)?

It might be worth checking out the FILE_SEARCH() function.
Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem (+solution) with make_rt
Next Topic: move window object programmatically

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:14:18 PDT 2025

Total time taken to generate the page: 0.00426 seconds