comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Deleting files from IDL
items: Re: Deleting files from IDL
items: Re: deleting files

Deleting files from IDL
type: item
description: Hello all, I have a file selection widget which gives me an option to pick an old file, pick no file or create a new one. The name for the new file is entered in an editable text widget. The problem is that if i make a mistake with the name the file gets created immediately, and when i enter a new name i end up with two files. Ok i could create the file after i'm finished rather than straight away but for my application this is not practicable. I'm running under Unix and if i use spawn,'rm filename' it doesn't work since filename in the IDL code is a variable (e.g.state.file).What i would really like is an IDL command which removes a file but i don't know of any. I'm thinking of something like IDL>remove_file,state.file Does anyone know if such a thing exists? Thanks in advance, David
creator: cabr69
date: 1995-05-18T07:00:00-00:00

Re: Deleting files from IDL
type: item
description: In article it5@kwuz.nerc-keyworth.ac.uk, Fergus Gallagher <F.Gallagher@nerc.ac.uk> writes: > cabr69@ccsun.strath.ac.uk ( "D.H.Brooks") wrote: >> I'm running under Unix and if i use >> >> spawn,'rm filename' >> >> it doesn't work since filename in the IDL code is a variable (e.g.state.file).What i >> would really like is an IDL command which removes a file but i don't > know of any. > > I would suggest > > IDL> spawn,'rm '+state.file > > or have I misunderstood? > > Fergus Why not: IDL> openr, unit, state.file, /get_lun, /delete, error=error IDL> if error eq 0 then free_lun, unit else print, 'unable to open (delete)' ... and it should run under UNXI, VMS, MsWin, .... Karl ------------------------------------------------------------ ------------ Karlheinz Knipp knipp@ipi.uni-hannover.de ------------------------------------------------------------ ------------
creator: knipp
date: 1995-05-19T07:00:00-00:00

Re: Deleting files from IDL
type: item
description: cabr69@ccsun.strath.ac.uk ( "D.H.Brooks") wrote: > > Hello all, > > I have a file selection widget which gives me an option to pick an old file, pick > no file or create a new one. The name for the new file is entered in an editable > text widget. The problem is that if i make a mistake with the name the file > gets created immediately, and when i enter a new name i end up with two files. Ok i > could create the file after i'm finished rather than straight away but for my > application this is not practicable. I'm running under Unix and if i use > > spawn,'rm filename' > > it doesn't work since filename in the IDL code is a variable (e.g.state.file).What i > would really like is an IDL command which removes a file but i don't know of any. > I'm thinking of something like > > IDL>remove_file,state.file > > Does anyone know if such a thing exists? > > Thanks in advance, > > David In UNIX you can use the SPAWN routine to do this. I've written a short routine called DELETE_FILES: ================================================= ; DELETE_FILES.PRO 11-22-94 ; ; Function to delete specified files. Returns 0 if successful, -1 if not. ; First searches for files and if not found returns 0 (otherwise an ; "error" occurs when you try to delete them). ; FUNCTION delete_files, to_delete ret = file_find(to_delete, temp) ; First search for files case (ret) of -1: return, 0 ; No files found (ok) -2: return, -1 ; Argument To_Delete undefined/null else: endcase command = 'rm ' + to_delete + ' 2>&1' SPAWN, [ "/bin/sh", "-c", command ], results, /NOSHELL if (results(0) eq '') then begin return, 0 endif else begin message, ' (rm) ' + results(0), /continue return, -1 endelse END ========================= Here is the FILE_FIND function used above. I like it better than the FINDFILE IDL function: ========================= ;----------------------------------------------------------- ----------------- ; function File_Find ; ; Takes file specification, expands it and returns a list of matchin…
creator: David S. Foster/Admin
date: 1995-05-22T07:00:00-00:00

Re: deleting files
type: item
description: Klaus Scipal wrote: Hi I am running pv-wave under win95. Is there a possibility to copy and delete external files. Under UNIX this is easily done with SPAWN, is there a similar way with win95 Klaus In idl you can use the keyword /delete by open to remove after close the file. &nbsp; &nbsp; --&nbsp; R.Bauer&nbsp; Institut fuer Stratosphaerische Chemie (ICG-1) Forschungszentrum Juelich email: R.Bauer@fz-juelich.de &nbsp;
creator: R. Bauer
date: 1998-03-30T08:00:00-00:00