Created
June 12, 2014 21:33
-
-
Save gergelypolonkai/6c6438cdc6cd0b7b781e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# A generalised converter to convert all files of | |
# a given extension in a directory to another | |
# type. | |
# | |
# I simply assume that yourConverter can detect | |
# the input files' type, and figure out the | |
# destination type from $ext_out | |
ext_in=doc | |
ext_out=txt | |
# Set the input field separator to newline only. | |
# This is required if you have at least one file | |
# with a space in its name. | |
IFS=' | |
' | |
for i in `ls -1 *.$ext_in` | |
do | |
o="${i%$ext_in}$ext_out" | |
yourConverter -i "$i" -o "$o" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment