exists or similar command to work like grep on file system files

Richard D. Williams richard at appgrp.net
Wed Feb 12 05:36:33 PST 2014


On 2/11/2014 10:19 PM, James Flanagan wrote:
> Server: 	FreeBSD 9.2
> Filepro:	5.7.0.4
>
> I am looking a way to have filepro verify whether a file exists using only a partial file name (like grep).  This will be used with photographs from all sorts of cameras so instead of trying to account for every possible camera filename structure, i would like to be able to supply filepro with 3-4 numbers and a directory and have filepro determine if a file with that number exists in a file name.  that will be accurate enough for what i need the code to do.
>
> below is a simple file list, and beneath that is how i would imagine i would use the exists command to accomplish what i am trying to do (however it does not appear to work with asterisk variables).  Is there either different syntax to use with the exists command, or possibly a different command that will do this?  I could use a system command that could LS the directory and then grep the result to a file, and then use exists on that output file, but i am looking to see if there is a more elegant solution self contained within filepro itself.   Thank you very much in advance.
>
> [root at filepro a]# ls
> IMGP0997.JPG	IMGP0999.JPG	IMGP1001.JPG	IMGP1003.JPG
> IMGP0998.JPG	IMGP1000.JPG	IMGP1002.JPG	IMGP1004.JPG
>
> ::aa="0998":
> :exists("/tmp/a/*"{aa{"*") eq "1":msgbox aa<"exists":
>
>
>
> James Flanagan
> Flantec.com
>
> email:	James at Flantec.com
> mobile:	760-458-8498
> home: 	219-221-6219
> text:		7604588498 at txt.att.net
>
> aim:		Flantec
> oovoo:	Flantec
> Skype:	Flantec
> ichat:	Flantec at mac.com
>
> home:	1901 Cidermill Road
> 		Michigan City, IN 46360
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20140211/1aff48b7/attachment.html
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
>
>
Try this:

create a user command /usr/local/bin/fileisnotzero

  if test -s /tmp/mytest
then echo yes
fi

in filepro:
system "rm -f /tmp/mytest;ls /path_to_my_folder/* | grep 1234 > 
/tmp/mytest;user answ = /usr/local/bin/fileisnnotzero;k=answ;

if: k eq "yes"
then: msgbox "eureka!"

Richard


More information about the Filepro-list mailing list