Created
November 24, 2014 09:44
-
-
Save RStrydom/a5f850b2bba96d8c2c17 to your computer and use it in GitHub Desktop.
File stuffing
This file contains hidden or 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 | |
| for FILE in `ls` | |
| do | |
| # remove the last dot and subsequent chars, then add new ext | |
| DIR="${FILE%%.*}" | |
| DIR=${DIR,,} | |
| mkdir -p "$DIR" | |
| mv "$FILE" "$DIR" | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy into folder and run.
This is not perfect yet as it makes mistakes with filenames that have spaces and does not exclude the script file.