使用unix ksh shell脚本或perl脚本监视文件夹中的新文件,并触发perl脚本 [英] Monitor folder for new files using unix ksh shell script or perl script and trigger perl script

查看:82
本文介绍了使用unix ksh shell脚本或perl脚本监视文件夹中的新文件,并触发perl脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在谷歌搜索和溢出,找不到可用的任何东西.

I've been Googling and Overflowing for a bit and couldn't find anything usable.

我需要一个脚本,该脚本监视公用文件夹并在创建新文件时触发,然后将文件移到专用位置.

I need a script that monitors a public folder and triggers on new file creation and then moves the files to a private location.

我在unix上有一个samba共享文件夹/exam/ple/映射到Windows上的X:\.在某些操作中,txt文件被写入共享.我想绑架该文件夹中出现的所有txt文件,并将其放入Unix上的私有文件夹/pri/vate中.移动该文件后,我想触发一个单独的perl脚本.

I have a samba shared folder /exam/ple/ on unix mapped to X:\ on windows. On certain actions, txt files are written to the share. I want to kidnap any txt file that appears in the folder and place it into a private folder /pri/vate on unix. After that file is moved, I want to trigger a separate perl script.

编辑 还在等着看shell脚本,如果有人有任何想法...一些东西将监视新文件,然后运行类似的东西:

EDIT Still waiting to see a shell script if anyone has any ideas... something that will monitor for new files and then run something like:

#!/bin/ksh
mv -f /exam/ple/*.txt /pri/vate

推荐答案

检查

Check incron. It seems to do exactly what you need.

这篇关于使用unix ksh shell脚本或perl脚本监视文件夹中的新文件,并触发perl脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆