【发布时间】:2013-11-17 19:40:40
【问题描述】:
我希望创建一个程序来压缩在查找参数指定的目录中创建的任何文件,并将其作为后台进程运行。我对它进行了大量评论,以便更好地了解我正在努力实现的目标。我在我的 MacBook Pro 终端上运行它,OS X 版本 10.9
#!/bin/sh
#find file in directory listed below
#type f to omit directories or special files
#mtime/ctime is modified/created -0 days or less
#name is with the name given in double quotes
#asterik meaning any file name with any file extension
#use xargs to convert find sequence to a command for the line after pipe
find /Users/name/thisdirectory type f -ctime -0 -name "'*'.'*'" | xargs zip -
【问题讨论】: