1
0
mirror of https://github.com/balkian/gists.git synced 2025-01-31 15:18:18 +00:00
gists/repos/4322258/tar-and-scp.sh
J. Fernando Sánchez 6625e71312 Add 'repos/4322258/' from commit '0b2bff42ba422c022c293b59a6a9d43c0e23e5e1'
git-subtree-dir: repos/4322258
git-subtree-mainline: 1ff85c6ab5
git-subtree-split: 0b2bff42ba
2021-10-30 15:14:19 +02:00

15 lines
325 B
Bash

#!/bin/bash
tosend=""
for i in *.log; do
dir=$(echo $i | awk '{split($1,a,"_"); print a[1]}');
if [ ! -d $dir ]; then
mkdir $dir;
fi;
mv $i $dir;
tosend="$tosend\n$dir"
done
for i in $(echo -e $tosend | uniq);do
echo Compressing $i
tar -zcvf $i.tar.gz $i
scp $i.tar.gz user@server
done