Posted By

aresnick on 01/07/09


Tagged

Bash mkdir directories mv mv-p


Versions (?)

mv a file to a nonexistent location, creating the directory structure needed


 / Published in: Bash
 

  1. mvp() {
  2. oldFilePath=$1
  3. newFilePath=$2'
  4.  
  5. if [ ! -f $newFilePath ]; then
  6. mkdir -p ${newFilePath%/*}
  7. mv $oldFilePath $newFilePath
  8. fi
  9. }

Report this snippet  

You need to login to post a comment.