Advertisement
s243a

cp_preserve_path

Jan 16th, 2016
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.31 KB | None | 0 0
  1. # http://www.pearltrees.com/s243a/preserve-path-strip-from-ruby/id15335231
  2. # http://murga-linux.com/puppy/viewtopic.php?t=101911
  3. #!/bin/bash
  4. #cp_preserve_path
  5. prefix=$1
  6. file_path=$2
  7. file_dir=${file_path%/*}
  8. target="$prefix$file_dir"
  9. if [[ ! -d $target ]] ;then
  10.   mkdir -p $target
  11. fi
  12. cp $file_path $target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement