Created
September 7, 2017 14:34
-
-
Save sudodoki/37d9e49fca592ce20a4d648653da60d8 to your computer and use it in GitHub Desktop.
split filename and move `abcdefgh.txt` -> `ab/cd/efgh.txt`.
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 | |
# find input -type f -maxdepth 1 | parallel --load 100% ./splitter.sh input {} | |
input_dir=$1 | |
f=$2 | |
if [[ -f $f ]] | |
then | |
filename=$(basename $f) | |
enclosing="${filename:0:1}/${filename:1:1}/" | |
mkdir -p "$input_dir/$enclosing" | |
mv $f "$input_dir/$enclosing$filename" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment