/usr/share/gnudatalanguage/lib/file_delete.pro is in libgnudatalanguage0 0.9.7-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ;+
; NAME: FILE_DELETE
;
;
;
; RESTRICTIONS: only for Unix (Unix, Linux and Mac OS X) systems
;
; MODIFICATION HISTORY:
; - April 2009: created by Alain Coulais, request by Igor C.
; - June 2010: modified by Lea Noreskal
;-
; LICENCE:
; Copyright (C) 2009, Alain Coulais
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;-
; ---------------------------------
;
pro FILE_DELETE_ONE, list_of_files, allow_nonexistent=allow_nonexistent, $
quiet=quiet, verbose=verbose , recursive=recursive, $
noexpand_path=noexpand_path
command='\rm '
option=''
if KEYWORD_SET(allow_nonexistent) then begin
option=option+'f'
endif
if KEYWORD_SET(recursive) then begin
option=option+'r'
endif
if KEYWORD_SET(verbose) then begin
option=option+'v'
endif
if (STRLEN(option) GT 0) then begin
option='-'+option
endif
for ii=0,N_ELEMENTS(list_of_files)-1 do begin
; escape special char
nameescp=escape_special_char(list_of_files[ii])
if (Not KEYWORD_SET(noexpand_path)) then begin
struct=FILE_INFO(list_of_files[ii])
if (struct.exists) then nameescp=escape_special_char(struct.name)
endif
; empty directory
emptdir=''
if (FILE_TEST(nameescp , /directory) and (Not KEYWORD_SET(recursive)) ) then begin
res = FILE_SEARCH(list_of_files[ii] , '*' , COUNT=nb)
if ((nb eq 0) and (Not KEYWORD_SET(recursive))) then emptdir=' -r'
endif
res = FILE_INFO(nameescp)
if ((res.EXISTS eq 1) and (res.WRITE ne 0)) then begin
SPAWN, command+option+emptdir+' '+nameescp, result, result_error
; /QUIET is used to suppress error message when an error happens. It does not affect the logging of the action which is controlled by /VERBOSE.
if KEYWORD_SET(verbose) then print,'% FILE_DELETE: Removed file: ', nameescp
endif else if NOT(KEYWORD_SET(quiet)) then begin ; No error message when /QUIET
if ( res.EXISTS ne 1 ) then if NOT(KEYWORD_SET(allow_nonexistent)) then print, '% FILE_DELETE: No such file: ', list_of_files[ii]
if ( res.EXISTS eq 1 and res.WRITE eq 0 ) then print, '% FILE_DELETE: No right to delete: ', nameescp
endif
endfor
end
pro FILE_DELETE, files0, files1, files2, files3, files4, files5, files6, files7, files8, files9, $
files10, files11, files12, files13, files14, files15, files16, files17, files18, files19, $
files20, files21, files22, files23, files24, files25, files26, files27, files28, files29, $
allow_nonexistent=allow_nonexistent, noexpand_path=noexpand_path, recursive=recursive, $
quiet=quiet, verbose=verbose
if ( strupcase(!version.os_family) eq 'WINDOWS') then message,"Sorry, FILE_DELETE is not available on Windows (FixMe!)"
if (N_PARAMS() LT 1) then begin
print, '% FILE_DELETE: Incorrect number of arguments.'
return
endif
list=list(files0, files1, files2, files3, files4, files5, files6, files7, files8, files9, $
files10, files11, files12, files13, files14, files15, files16, files17, files18, files19, $
files20, files21, files22, files23, files24, files25, files26, files27, files28, files29)
for __i__=0, N_PARAMS()-1 do begin
CALL_PROCEDURE,'FILE_DELETE_ONE',list[__i__],allow_nonexistent=allow_nonexistent, quiet=quiet, verbose=verbose, recursive=recursive, noexpand_path=noexpand_path
endfor
end
|