Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -ne 2 ]
- then
- echo "USAGE: `basename $0` imenik_od imenik_do"
- exit 1
- fi
- if [ ! -d $2 ]
- then
- mkdir -p $2
- fi
- FROM=$1
- TO=$2
- files=`ls -l $FROM | grep ^- | grep [A-Z][A-Z]*\.csv$ | awk 'print $9'`
- for file in $files
- do
- filename=`awk -F. {print $1}`
- #first cut+paste the .csv files
- mv ${FROM}${file} ${TO}${file}
- #then rename(change) their extension
- mv ${TO}${file} ${TO}${filename}.moved_csv
- done
- sum_filesizes=`ls -l $TO | grep ^- | awk '$9~/\.moved_csv$/ {print $5}' | awk 'BEGIN {total=0} {total+=$1} END {print total}'`
- echo "Vkupnata golemina na premestenite datoteki e $sum_filesizes"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement