   (format "%s/%s-%s.ogg"  path date name))
 
 
+(defn gen-command-line
+  "Takes a file glob, returns the string command to process it"
+  [cmd-path path {:keys [name date filenames]}]
+  (let [cmd (format "cat %s | %s > %s"
+                    (umisc/inter-str " " filenames)
+                    cmd-path
+                    (format-show-save path name date))]
+    (format "echo \"%s\"\n%s\n" cmd cmd)))
+
 
 (defn gen-filenames
   [cmd-path path files]
-  (umisc/inter-str "\n"
-                   (for [{:keys [name date filenames]}  files]
-                     (let [cmd (format "cat %s | %s > %s"
-                                       (umisc/inter-str " " filenames)
-                                       cmd-path
-                                       (format-show-save path name date))]
-                       (format "echo \"%s\"\n%s\n" cmd cmd)))))
-      
+  (umisc/inter-str "\n" (map (partial gen-command-line cmd-path path)  files)))
+
+
 
 
 

(ns defragment.core
  (:gen-class)
  (:import java.io.SequenceInputStream)
  (:require [me.raynes.conch :refer [programs with-programs let-programs] :as sh]
            [utilza.repl :as urepl]
            [clojure.tools.trace :as trace]
            [useful.map :as um]

       get-oggs
       (map parse)
       prepare-all
       (execute-all! cmd-path out-oggs-path out-commands-file)))




