oldest files will delete after reach to 21G
I want to delete the oldest files in a folder after reaching to 21Gig.
for this action i write the following code.
Dose it ok?
...
DUMP_DIR_SIZE_BEFOR=$(du -sm $ODP_PATH | awk '{print $1}')
while [DUMP_DIR_SIZE_BEFOR gt 21000]
do
rm "ls $ODP_PATH -lrt|tail -1"
DUMP_DIR_SIZE_BEFOR=$(du -sm $ODP_PATH | awk '{print $1}')
done
Narges.
|