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

2003-11-02 Thread Anton Rolls
RebOldes' code below is not as fast as possible yet, I think, though less likely to write a bug by missing or adding an extra [ next dir-port ], and it is less code to maintain, still... If you look at source delete, it is opening a directory port to do its work. Better to use remove on a direct

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

2003-11-02 Thread rebOldes
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

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

2003-10-28 Thread Gregg Irwin
Hi Tom, TF> How can I elimintate most of the "rejoins" that I use? TF> I rejoin everything. If all you have is a hammer... JOIN and REJOIN will return the same datatype as the first item you give them, so you can avoid doing a lot of TO-* stuff if you don't use strings for everything (and look

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

2003-10-28 Thread Joel Neely
Hi, Tom, Saving some typing and evaluation... Tom Foster wrote: > > home: to-file rejoin ["~" "/"] > > base: to-file rejoin [home "attempt-it/"] > > foreach file read base [ > if found? (find file "editpost") [ > delete base/:file > ] > ] > You can just use a literal FILE! v

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

2003-10-28 Thread Tom Foster
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

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

2003-10-28 Thread Anton Rolls
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 [