Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- folder="files"
- [ -a "$folder" ] && echo "$folder exists" || mkdir "$folder"
- move(){
- echo "Moving $1 for ${folder}..."
- mv $1 "$folder"
- }
- copy(){
- echo "Copying $1 for ${folder}..."
- cp $1 "$folder"
- }
- while getopts ":f:" arg; do
- case "$arg" in
- f)
- f="${OPTARG}"
- ;;
- esac
- done
- for file in *
- do
- if [ "$f" = "true" ]
- then
- move "$file"
- else
- copy "$file"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement