select wild card for files with dots

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

select wild card for files with dots

Post by timle » Fri Dec 30, 2016 12:01 pm

I would like the script check the folder to see if the file existed but the filename has (.) in it, So the normal wildcard *.
does not work, do you have a trick to do that

thanks,
EX



IfFileexists>C:\PAYSTUBS\STUBS\*._j.john.pdf,
MessageModal>found it
else
MessageModal>notfound

Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Re: select wild card for files with dots

Post by Shadow3641 » Fri Dec 30, 2016 6:35 pm

Timle check to make sure you have your file named correctly. I made a little test code for trial and it works fine.

I have a text file on my desktop named "my.test"

and ran the code

Code: Select all

IfFileExists>C:\Users\Me\Desktop\*.test.txt
MessageModal>found it
else
MessageModal>notfound
Endif
and if found it hope this helps

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Re: select wild card for files with dots

Post by timle » Sat Dec 31, 2016 12:48 pm

In my example, I have more dot than regular .ext
if I have two files named : document_test.1.pdf and document_test.2.pdf
and I want the script to find the first record , if it finds it it will email to someone

IfFileexists>C:\PAYSTUBS\STUBS\*_.test.1.pdf
MessageModal>found it
else
MessageModal>notfound

if you run this script above, it will say not found

Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Re: select wild card for files with dots

Post by Shadow3641 » Fri Jan 20, 2017 2:44 pm

Sorry for the delay in response

i tried the code you posted and your right it does not like it for some reason. Playing around with it tho, I found that it does not like the " *_ " part .To solve this I just backed it up a bit past the " _ "

Code: Select all

IfFileExists>C:\Users\ME\Desktop\*est.1.txt
MessageModal>found it
else
MessageModal>notfound
Endif
And it was able to find a file on my desktop named document_test.1.txt

Note: it also did not like the letter after the " _ " so that is why the " t " in test is missing.

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Re: select wild card for files with dots

Post by timle » Fri Jan 20, 2017 3:09 pm

interesting...thank you

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts