bash
Posted on February 24th, 2014
[for]
[Time]
#!/bin/bash
FILES=$1/*.pkt
#echo "start"
#echo "$FILES"
for f in `ls $FILES`
do
echo "Processing $f file..."
7za a -tzip -v50M "$f.zip" "$f"
# take action on each file. $f store current file name
#cat $f
done
[Time]
- Time / Date Commands: http://www.tldp.org/LDP/abs/html/timedate.html
- format: http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/
[if then else]
[File/Directory]
- Directory exist : http://stackoverflow.com/questions/59838/how-to-check-if-a-directory-exists-in-a-shell-script
- Recursive : http://jashliao.pixnet.net/blog/post/155921753-%E6%AF%8F%E5%A4%A9%E4%B8%80%E5%80%8Blinux%E6%8C%87%E4%BB%A4-ls(%E7%94%A8%E4%BE%86%E5%88%97%E5%8D%B0%E5%87%BA%E7%9B%AE%E5%89%8D%E7%9A%84%E7%9B%AE%E9%8C%84%E7%9A%84