#!/bin/sh case ${1} in -w) # wideprint, list case ${2} in V1) echo "Listing old zayavki on V1" /usr/bin/find /V1/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V2) echo "Listing old zayavki on V2" /usr/bin/find /V2/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V3) echo "Listing old zayavki on V3" /usr/bin/find /V3/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V4) echo "Listing old zayavki on V4" /usr/bin/find /V4/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V5) echo "Listing old zayavki on V5" /usr/bin/find /V5/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; *) echo "Usage: $0 <-w[r] | -e[r]> V{12345}" echo "Be careful with -wr and -er keys. 'r' stands for \"remove\" here" esac ;; # wideprint list all -W) # wideprint, list echo "Listing old zayavki on V*" /usr/bin/find /V[1-5]/*/zayavki -type f -ctime +14d -exec ls -lh {} \; ;; -wr) # wideprint, remove case ${2} in V1) echo "Removing old zayavki on V1" /usr/bin/find /V1/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V2) echo "Removing old zayavki on V2" /usr/bin/find /V2/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V3) echo "Removing old zayavki on V3" /usr/bin/find /V3/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V4) echo "Removing old zayavki on V4" /usr/bin/find /V4/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V5) echo "Removing old zayavki on V5" /usr/bin/find /V5/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; *) echo "Usage: $0 <-w[r] | -e[r]> V{12345}" echo "Be careful with -wr and -er keys. 'r' stands for \"remove\" here" esac ;; -Wr) # wideprint, remove ALL echo "Removing old zayavki on V*" /usr/bin/find /V[1-5]/*/zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; -WR) # wideprint, remove ALL echo "Removing old zayavki on V*" /usr/bin/find /V[1-5]/*/zayavki -type f -ctime +14d -print -exec rm {} \; ;; # # EPD -e) # epd, list case ${2} in V1) echo "Listing old EPD zayavki on V1" /usr/bin/find /V1/*/epd_zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V2) echo "Listing old EPD zayavki on V2" /usr/bin/find /V2/*/epd_zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V3) echo "Listing old EPD zayavki on V3" /usr/bin/find /V3/*/epd_zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V4) echo "Listing old EPD zayavki on V4" /usr/bin/find /V4/*/epd_zayavki -type f -ctime +14d -exec ls -lh {} \; ;; V5) echo "Listing old EPD zayavki on V5" /usr/bin/find /V5/*/epd_zayavki -type f -ctime +14d -exec ls -lh {} \; ;; *) echo "Usage: $0 <-w[r] | -e[r]> V{12345}" echo "Be careful with -wr and -er keys. 'r' stands for \"remove\" here" esac ;; -er) # warn user echo "* Please stop now and think twice. *" echo "Have you backed up all those EPD files before deleting them? epickup(1) can do it for you." echo "Hit to cancel or to continue removing EPD files." read A # epd, remove case ${2} in V1) echo "Removing old EPD zayavki on V1" /usr/bin/find /V1/*/epd_zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V2) echo "Removing old EPD zayavki on V2" /usr/bin/find /V2/*/epd_zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V3) echo "Removing old EPD zayavki on V3" /usr/bin/find /V3/*/epd_zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V4) echo "Removing old EPD zayavki on V4" /usr/bin/find /V4/*/epd_zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; V5) echo "Removing old EPD zayavki on V5" /usr/bin/find /V5/*/epd_zayavki -type f \! -name "*.rar" -ctime +14d -print -exec rm {} \; ;; *) echo "Usage: $0 <-w[r] | -e[r]> V{12345}" echo "Be careful with -wr and -er keys. 'r' stands for \"remove\" here" esac ;; *) echo "Usage: $0 <-w[r] | -e[r]> V{12345}" echo "Be careful with -wr and -er keys. 'r' stands for \"remove\" here" esac