s243a

cp_fm_list.sh

Jan 16th, 2016
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. http://murga-linux.com/puppy/viewtopic.php?t=101911
  2. http://www.pearltrees.com/s243a/bash-script-strip-from-ruby/id15335212
  3.  
  4. #!/bin/bash
  5. echo "determine the list of files to copy" > "`tty`"
  6. if [[ ${#inFile} -gt 0 ]]; then
  7.   echo "Readnig in file."  > "`tty`"
  8.   #IFS=$(echo -en "\n\b")
  9.   echo "-----------------Original Files-----------------------"
  10.   echo  "$(cat $inFile)"
  11.   files=$(cat "$inFile" | ./strip_prefixes "$oldPrefix")
  12.   echo "-----------------Stripped Files-----------------------"
  13.     echo  "$files"
  14.   #IFS=" "
  15. else
  16.   echo "reading files from pipe" > "`tty`"
  17.   files="$(read -d EOF | ./strip_prefixes $oldPrefix)"
  18. fi
  19. if [[ ${#newPrefix} -gt 0 ]]; then
  20.   echo "Appending Prefix"  > "`tty`"
  21.   files=$(./append_prefixes "$newPrefix" "$files")
  22.   echo "-----------------Appended Files-----------------------"
  23.   echo  "$files"
  24.  
  25. fi
  26.  
  27.   echo "determine where to copy the files"
  28. if [[ ${#dest} -gt 0 ]]; then
  29.   echo "dest=$dest"
  30. else
  31.   dest=pwd # asdf
  32.   echo "dest=$dest"
  33. fi
  34. #Copy the files
  35. for aPath in $files; do
  36.   echo "aPath=$aPath"
  37.   echo "inFile=$inFile"
  38.   ./cp_preserve_path "$dest" "$aPath"
  39. done
Advertisement
Add Comment
Please, Sign In to add comment