I'm trying to simplifly a script into a single line which can find recursively files created yesterday, zip, move and remove depending of a condition.
I have this structure:
../main -> child1 (content: file01.csv, file02.xlsx, file03_20201028.xls, file04_20201028.xls)
|____ child2 (content: file05.xls, file06.xlsx, file07_20201028)
|___ child3 (file08.xls, file09.xlsx, file10_20201028.xls, file11_20201028.xls)
I have made this:
find $ORIGINPATH -type f -mtime -1 | zip -@ $ORIGINPATH/Backup_$YESTERDAY.zip
find $ORIGINPATH -type f -iname *$YESTERDAY* -exec rm -f {} \;
mv $ORIGINPATH/Backup_$YESTERDAY.zip $DESTINATIONPATH
I need to delete the files with date in their names and keep the rest.
Thanks in advance!