[Thread Prev][Thread Next][Index]

Re: [ferret_users] Check file exist before saving it

Hi Dan

To check the existence of a file, I use this:
yes? Let /Quiet test_file = `SPAWN("test -f test2.nc 2>/dev/null ; echo $?")`
yes? IF ` test_file EQ 0 ` THEN SAY File exists


Parc Technologique du Canal
8-10 rue Hermes
31520 Ramonville-Saint-Agne
Tel: + 33 5 61 39 38 51
Fax: +33 5 61 39 38 99

On 10/25/2011 09:56 AM, Yu, Hao-Cheng wrote:
Dear ferret users,

I would like to check file existence before saving it.
For example,

! add check existence code here
save/i=1:10/j=1:10/l=2/file=test2.nc var1,var2

Adding /clob will overwrite file, but if no /clob and file exist, ferret will stop and shows error.
So just curious about any ferret code could check this.

Sincerely, dan 

Click here to report this email as spam.

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement