Find the answer to your Linux question:
Results 1 to 4 of 4
i want to change all of the wav files to cdrs with sox and make a script that does it for me i already have all of the files in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Apr 2003
    Location
    TEXAS
    Posts
    314

    changing file types with sox


    i want to change all of the wav files to cdrs with sox and make a script that does it for me

    i already have all of the files in a directory i just dont know how to script

    can anybody point me to a good scripting tutorial

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    One idea is this:
    Code:
    for $file in *.wav; do sox -t .wav $file -t .cdr ${test%.wav}; done
    Then you can rm *.wav if you deem the operation successful. It should work, though I haven't tried it.
    Everything is documented in bash(1), so I don't really know if you need a tutorial. Might I suggest this:
    Code:
    man -t bash >bashman.ps
    gv bashman.ps &
    If you don't have gv installed, use ggv instead. If you want to print it then (and you have enough physical papers for that), do this:
    Code:
    man -t bash | lpr

  3. #3
    Linux User
    Join Date
    Apr 2003
    Location
    TEXAS
    Posts
    314

    says $file not proper identifier

    it says the $file is not a proper identifer

    why would it do that

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Sorry, that was just a typo. There shouldn't be a dollar sign at the first "file", like this:
    Code:
    for file in *.wav; do sox -t .wav $file -t .cdr ${file%.wav}.cdr; done
    There were some more typos as well, I must have been tired.
    That for command loops through all files matching *.wav, putting the filename in the variable file (which is accessed with $file). ${file%.wav}.cdr removes the .wav extension from $file, and add .cdr to it.
    Like I said, it's all documented in bash(1).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •