Created
September 19, 2015 13:22
-
-
Save abhinavjain241/9243210d0a0c2f4f1769 to your computer and use it in GitHub Desktop.
[Shell Script] Make directories in a folder for each of your file.
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 | |
# Reference: (Thanks StackOverflow) - http://stackoverflow.com/questions/2859908/iterating-over-each-line-of-ls-l-output | |
# Copy the script into a folder. Run it. This will make a folder for each of your file present in the directory. | |
# Helps me to organize my Movie collection. | |
ls -p | grep -v / | while read x; do if [[ $x != "MakeDirectory.sh" ]]; then mkdir "${x%.*}"; mv "$x" "${x%.*}"; fi done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment