Mass File Naming
[1/2] from: aroberts::swri::edu at: 30-Aug-2001 21:23
I have a simple thing I want to do, but I'm too tired to figure it out. I want to rename
all the files in the current working directory, by chopping off the last two characters
of their file name.
Ie -
fred.txt.1
me.txt.2
your.txt.a
How can I do this?
Regards,
Aaron
[2/2] from: max:ordigraphe at: 31-Aug-2001 11:05
Here you go!
------------------------
rebol []
dirs: load %/c/
foreach file dirs [
either not (find file "/") [
oldname: copy file
probe file
remove copy clear find file last file
remove find file last file
probe file
rename oldfile file
][
print [file "is a directory"]
]
]
---------------------------
cheers!
-Max
Contrary to popular belief, Unix IS user-friendly...
its just picky on who it considers a friend