Skip to content

Instantly share code, notes, and snippets.

@rdm
Created February 6, 2014 13:40
Show Gist options
  • Save rdm/8844361 to your computer and use it in GitHub Desktop.
Save rdm/8844361 to your computer and use it in GitHub Desktop.
require 'csv'
stordir=: <'c:\voxtst\' NB. note < and trailing \
NB. Convert the csv file to a boxed J array
csvdata=: readcsv 'c:\voxtst\prophecy.csv'
NB. filenames
sourcefnames=: }. 0 {"1 csvdata
targetfnames=: stordir,each (}. 2 {"1 csvdata),each <'.wav'
assert (-: ~.) targetnames NB. unique file names
NB. uncomment next line to copy
NB. inspect results from above before proceeding
NB. targetfnames (fwrite~ fread)each sourcefnames
@rdm
Copy link
Author

rdm commented Feb 6, 2014

Alternate file copy mechanism:

status=: targetfnames fcopynew&> sourcefnames

status would typically be a two column result.

Column 0: _1 (copy failed), 0 (file previously copied), 1 (file successfully copied)
Column 1: length of file

If every attempt failed (for example if none of the source files existed) 'status' would instead be a list of _1s..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment