REBOL [
Title: "Sort Library Files by Category"
File: %sort-lib-files.r
Date: 2-Jun-2000
Author: "Carl Sassenrath"
Purpose: {
Copies REBOL script library files into subdirectories under
the primary categories.
}
Category: [script util file 2]
]
main-categories: [view email web net file script text util]
;-- Make directories for each main category:
foreach category main-categories [
dir: to-file category
if not exists? dir [make-dir dir]
]
;-- Copy files into category directories:
foreach file read %. [
if all [
script? file
header: first load/header file
in header 'category
][
foreach category main-categories [
if find header/category category [
dir: to-file category
print ["Copying:" dir/:file]
write dir/:file read :file
]
]
]
]