Created
June 23, 2018 07:43
-
-
Save Abreto/a6893f9c924c213030cf320909018562 to your computer and use it in GitHub Desktop.
Travel a directory recursively
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
#!/usr/bin/env bash | |
outdir=$2 | |
function travel() { | |
mkdir -p $outdir/$1 | |
for f in `ls $1` | |
do | |
if [ -d $1/$f ]; then | |
travel $1/$f | |
else | |
echo proccessing $1/$f ... | |
iconv -c -f GBK -t UTF-8 $1/$f -o "$outdir/$1/$f" | |
fi | |
done | |
} | |
travel $1 |
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
#!/usr/bin/env bash | |
function travel() { | |
for f in `ls $1` | |
do | |
if [ -d $1/$f ]; then | |
travel $1/$f | |
else | |
echo do something on $1/$f ... | |
fi | |
done | |
} | |
travel $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment