Last active
April 11, 2020 06:43
-
-
Save pgbrandolin/d1aa89cb9048c28e374ca05a159444f6 to your computer and use it in GitHub Desktop.
[folderhist.bat] Calcolo dello spazio in ambienti Windows #experica #viteria #emporiorossi #docmanager #dos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
#--- Path dello script ridefinito esplicitamente | |
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin | |
#--- Directory base su cui avviene la scansione | |
export THEBASEDIR=/home/e-progen/experica/experica | |
#--- Data corrente | |
export THEDATE=$(date +%Y%m%d) | |
#--- URLPART: Componenti url (da completare con l'ambiente) | |
URLBASE=http://127.0.0.1:8080 | |
URLPART=experica-sincro-edi- | |
DAYSKEEP=90 | |
#--- Directory in cui risiede lo script | |
export MYDIR=$(dirname "$(readlink -f "$0")") | |
export MYLOG=${MYDIR}/logs | |
export LOGFILE="$MYLOG/$(basename "$0" .sh).log" | |
export ZONES="test uat prod" | |
export DIRECTIONS="in out" | |
# | |
#--- Test User-------------------------------------------------------------------- | |
#if [ "$(whoami)" != "tomcat" ]; then | |
# echo "Script must be run as user: tomcat" | |
# exit -1 | |
#fi | |
#--- Creazione della directory logs (se non esiste) ------------------------------ | |
#if [ ! -d "$MYLOG" ]; then | |
# mkdir -p $MYLOG | |
#fi | |
# | |
#--- Log redirection ------------------------------------------------------------- | |
#exec 3>&1 4>&2 | |
#trap 'exec 2>&4 1>&3' 0 1 2 3 | |
#exec 1>>$LOGFILE 2>&1 | |
# | |
#--------------------------------------------------------------------------------- | |
echo "_S_ START: $(basename "$0") at $(date)" | |
echo "=== Script is located in directory: $MYDIR" | |
# | |
#--- Processing Zones and Directions | |
# | |
for z in $ZONES | |
do | |
echo "=== Processing Zone : [ $z ]" | |
for d in $DIRECTIONS | |
do | |
echo " === Processing Direction [ $d ] for Zone: [ $z ]" | |
if [ -d ${THEBASEDIR}/${z}/${d} ]; then | |
find ${THEBASEDIR}/${z}/${d} -mindepth 3 -maxdepth 3 -type d -not -path "*/err/*" -print0 | | |
while IFS= read -r -d '' filep; do | |
pathlast=$(echo $filep |cut -sd / -f 7-) | |
filed=$(dirname "$filep") | |
dirnew=${filed}/${THEDATE} | |
# http://experica-sincro-edi/experica-sincro-edi-test/delete-older-than-90-days/in/desadv/0000000001/desadv1 | |
# curl -s -H 'Cache-Control: no-cache' -A 'experica-sincro-edi' | |
theurl="${URLBASE}/${URLPART}${z}/delete-older-than-${DAYSKEEP}-days/${pathlast}" | |
echo curl -s -H 'Cache-Control: no-cache' -A 'experica-sincro-edi' " " ${theurl} | |
#printf 'FilePath %s\n' "$filep" | |
#printf 'FilePathL %s\n' "$pathlast" | |
printf 'TheURL %s\n' "$theurl" | |
done | |
else | |
echo "Directory ${THEBASEDIR}/${z}/${d} Not present. Skipping" | |
fi | |
done | |
done | |
# | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment