[Swift-devel] code to test for file existence in swift

Michael Wilde wilde at mcs.anl.gov
Fri Apr 25 10:19:34 CDT 2008


Mike, could you elaborate on the use case for this?

Do you want the swift code to execute a procedure only if a file exists?

Exists on the submit host?

One way is write a tiny shell script that returns 1 or True if the file 
exists and zero otherwise.  You'll need, I think, to use @extractint: 
the return value (from the test) in fact needs to go into a file, then 
extractint can return t/f based on the value of that file:

@extractint(file) will read the specified file, parse an integer from 
the file contents and return that integer.

if, switch or iterate could then be used to act on the 
exists/doesnt-exist condition.

I'm not sure if there's a more elegant way to do this. Depends a bit on 
your actual use case.

- Mike




On 4/25/08 10:08 AM, Mike Kubal wrote:
> Could someone suggest swift code for testing for the
> existence of a file?
> 
> Thanks,
> 
> Mike
> 
> 
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> 
> 



More information about the Swift-devel mailing list