view src/rlm/sanitize_file.clj @ 8:7240d7a5f959

random files :)
author Robert McIntyre <rlm@mit.edu>
date Thu, 19 Jul 2012 10:56:39 -0500
parents 78a630e650d2
children
line wrap: on
line source
1 (ns rlm.sanitize-file
2 (:import java.io.File)
3 (:use clojure.contrib.str-utils))
6 (defn sanitize-file-name
7 "given a file name, convert it into a valid file name.
8 currently only works for linux"
9 [#^String name]
10 ;; as far as I know, all that must be done is removal of the
11 ;; path separator.
13 (re-gsub
14 (re-pattern (str File/separatorChar))
15 " " ;; replace "/" with " "
16 name))