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


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.