我需要从我的网络服务器中的目录中删除文件,并且我需要一些脚本来自动执行此操作.而且需要满足的条件也很少.
I need to delete files from a directory in my web-server and I need some script to do it automatic. And there is few more conditions which need to be fulfilled.
对于删除文件,我正在考虑某种玉米任务,但我对它们一无所知,所以这对我来说很棘手.
要删除文件,然后达到一定的限制,我在想某种 PHP 脚本是我的帮助.可能有专门用于这些东西的库.
无论如何,我都会很高兴得到任何帮助.也许我只是需要一些新鲜的想法来为谷歌想出一个正确的关键字;P
For deleting files I was thinking of some kind of corn task but I do not know a thing about them so it is tricky for me.
To delete files then a certain limit is reached I was thinking that some kind of PHP script my help. May be there is a library meant for these things.
Any way I will be very happy for any kind of help. May be I just need some fresh thoughts to come up with a right keyword for google ;P
我的服务器在 linux 上运行.
My server runs on linux.
如果你的服务器运行的是 linux,cron
作业是最好的选择.只需编写一个脚本来检查您提到的条件(使用例如 stat
和其他一些工具)并在适用时删除文件,并将 crond
设置为每 24 小时运行一次.这里是cron
的简短介绍.
If your server is running linux, a cron
job is the best option. Simply write a script that checks the conditions you mention (using e.g. stat
and some other tools) and deletes the file if they apply, and set crond
to run it every 24 hours. Here's a short introduction to cron
.
在 Windows 上,您可以使用脚本和计划任务执行类似的操作.
On Windows, you'd do something similar with a script and a scheduled task.
这篇关于自动从网络服务器中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!