You are right @michaelk. Let me explain it:
In the remote folder, I have many folders sctructured like this
# folder of 2022/04/10
ASPX_4T7_20220410_0000
ASPX_4T7_20220410_0030
ASPX_4T7_20220410_0100
ASPX_4T7_20220410_0130
....
# folder of 2022/04/11
ASPX_4T7_20220411_0000
ASPX_4T7_20220411_0030
ASPX_4T7_20220411_0100
ASPX_4T7_20220411_0130
...
In the "Other things", I want to tell the script:
Code:
[[ ! -f $LOCAL_DIR ]] && mkdir -p $LOCAL_DIR 2>/dev/nul
cd $LOCAL_DIR
DATE_OF_TODAY=$(date +'%Y%m%d')
# In the remote directory, split evry folder and compare it's name to TODAY folder
for f in $REMOTE_DIRECTORY/*; do
SUFFIX2=`basename "$f"`
if [[ $SUFFIX2 =~ ^ASPX_4T7_* ]]; then
SUFFIX1=${SUFFIX2:0:${#SUFFIX2}-5}
# if matches, copy all TODAY folders except BLACKLISTED
if [[ "$SUFFIX1" == "ASPX_4T7_$DATE_OF_TODAY" ]]; then
# .... here comes the copy of remote files excluding a balcklist array ()
fi
fi
done