|
From: Ethan A M. <merritt@u.washington.edu> - 2006-03-10 07:29:17
|
On Thursday 09 March 2006 11:03 pm, Petr Mikulik wrote:
>
> No examples has been presented until now, but I've just constructed it this
> way:
>
> fileexist(name)=\
> system(sprintf("bash -c \"if [ -a %s ]; then echo 1; else echo 0; fi\"", name))
>
> print fileexist('a')
> print fileexist('aa')
>
> Any better solution?
Didn't we start this whole discussion thread with comparisons of
"find" vs. "test" and their use to check file existence or updates?
ierr = system("test -e 'a'")
if (ERRNO) print "No such file"
ierr = system("test 'a' -nt 'b'")
if (!ERRNO) print "a is newer than b"
Maybe that was another thread....
--
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle 98195-7742
|