Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- destination=("/e/library/notes/back" "/home/user" "/c/WINDOWS/bin")
- source="/home/user/mylog"
- prefix="mlog"
- function do_clear {
- for a_path in ${destination[@]}; do
- find $a_path -iname "*$prefix*" -exec rm {} \;
- done
- echo "cleaned..."
- exit 0
- }
- if [ "$1" == "-c" ]; then do_clear; fi
- function do_copy {
- for a_path in "${destination[@]}"; do
- cp $source "$a_path/$prefix`date +%Y%b%d`"
- if [ $? -ne 0 ]; then return 1; fi
- done
- return 0
- }
- do_copy
- if [ $? -eq 0 ]; then echo "succeed..."; exit 0
- else echo "SOMETHING WRONG!"; exit 1;
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement