Skip to content

Instantly share code, notes, and snippets.

@RStrydom
Created November 24, 2014 09:44
Show Gist options
  • Select an option

  • Save RStrydom/a5f850b2bba96d8c2c17 to your computer and use it in GitHub Desktop.

Select an option

Save RStrydom/a5f850b2bba96d8c2c17 to your computer and use it in GitHub Desktop.
File stuffing
#!/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
@RStrydom
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment