scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

mkdmv.sh (429B)


      1 #!/bin/sh
      2 # mkdmv (mkdir & mv) 
      3 # description: mkdir $1 && mv ($2...$n) 1to it
      4 # e.g.$ mkdmv ~/new-dir ~/var/tmp/file*
      5 
      6 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
      7 	echo "Usage: mkdmv DIRECTORY FILEPATH..."
      8 	echo ""
      9 	echo "mkdir DIRECTORY and mv all listed FILEPATH... files into it"
     10 	exit
     11 fi
     12 
     13 #mkdir $1
     14 dir="$1";
     15 mkdir -p "$dir"
     16 shift;
     17 
     18 #cp files ($2...$n) into $1
     19 for file in $@; do
     20     mv "$file" "$dir";
     21     shift;
     22 done
     23