Created
December 26, 2014 04:08
-
-
Save codeniko/77971214a513693d25f9 to your computer and use it in GitHub Desktop.
Short script to move all non-dir files to a dir specified as the argument
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
#!/bin/bash | |
scriptname='mvfiles.sh' | |
if [ "$#" -ne 1 ]; then | |
/bin/echo "Pass in destination dir as argument" | |
exit 1 | |
else | |
/bin/echo "$(/bin/ls -l | /bin/egrep '^-' | /usr/bin/tr -s ' ' | /usr/bin/cut -d ' ' -f 9-)" | while read line; do if [ "${line}" != "${scriptname}" ]; then /bin/mv "${line}" "${1}"; fi done | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment