Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: check me? deleting files based on a pattern

From: rebol-list2:seznam:cz at: 31-Oct-2003 11:09

Hello Tom, Tuesday, October 28, 2003, 3:02:40 PM, you wrote: TF> Anton Rolls wrote:
>>Looks pretty safe to me. >>You are just in one directory. >>This will delete all files with "editpost" >>in the name somewhere. >>I would catch errors while deleting the file >>so you are not interrupted by a single >>"file access error" because one file is in use. >> >> foreach file read base [ >> if find file "editpost" [ >> if error? set/any 'err try [delete base/:file][ >> print mold disarm err >> ] >> ] >> ] >> >>You can, by the way, say this: >> >> home: %~/ >> base: join home %attempt-it/ >> >>How many files? >> >>Anton. >> >> >>
TF> Thanks Anton, TF> 7500 files. TF> the task is finished, I "risked it." I'll use your suggestions. I TF> especially like the error checking. TF> I've been a reboler for years and I'm still *very* clueless. TF> you brushed up against a question I've had for a while. How can I TF> elimintate most of the "rejoins" that I use? TF> I rejoin everything. If all you have is a hammer... TF> thanks again, TF> -tom If there is too many files you may try to open the directory as a port without buffering: files: open/direct base while [not tail? files][ file: first files if find file "editpost" [ if error? set/any 'err try [delete base/:file][ print mold disarm err ] ] files: next files ] close files -- Best regards, rebOldes -----------------[ http://oldes.multimedia.cz/ ]