scripts

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

mkdcp.sh (raw) (416B)


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