[REBOL] OOPS !!! Re: Mass File Naming
From: max::ordigraphe::com at: 31-Aug-2001 12:44
Hi All,
sorry, I pasted the wrong code... very bad version. :-(
the following code has the correct renaming command... the code
previously pasted REALLY SCREWS UP YOUR NAMES .... DO NOT USE IT!
This version processes the CURRENT directory the script resides in...
change the path to suit your needs.
I also left the rename statement commented so that you could run it
beforehand and watch it do its magic without wreaking havoc. Just to
secure you, that it correclty works.
note that directories aren't renamed... I figured your problem is only
with files. just remove the either, if you want ALL directories and
files to be edited.
here is the proper example:
------------------------------------
rebol []
file-list: load %./
foreach oldfile file-list [
either not (find oldfile "/") [ ; ignore directories
newfile: oldfile
probe newfile
newfile: head clear back back tail newfile
probe newfile
print ""
;rename oldfile newfile
][
;print [file "is a directory"]
]
]
----------------------------------
cheers!
-Max
Contrary to popular belief, Unix IS user-friendly...
its just picky on who it considers a friend