shosei

mv files w/ keyword to new dir

Mar 13th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1.  
  2. #/bin/bash  -x
  3.  
  4. # Move all files with a keyword to another directory
  5. # stdout a count of files moved with the keyword
  6.  
  7. file_name=`ls *key_word*`
  8. for i in ${file_name}
  9. do
  10. cp ${i} /home/target_dir
  11. count=`expr ${count} + 1 `
  12. done
  13. echo "Files transfered  \ ${count} "
Advertisement
Add Comment
Please, Sign In to add comment