从网络服务器自动删除文件 [英] Automatically delete files from webserver
问题描述
我需要从我的网络服务器的目录中删除文件,我需要一些脚本来自动完成。而且还有几个条件需要实现。
- 它必须清理目录,然后总文件大小超过某个限制1,5GB
- 该文件将每24小时删除一次。
- 不会删除10个红绿灯20分钟的新文件
- 如果上述所有条件同时工作,那就太棒了。
对于删除文件,我正在考虑某种玉米任务,但我不知道关于它们的一些事情,所以对我来说很棘手。
删除文件然后达到一定的限制我正在考虑某种PHP脚本我的帮助。可能有一个图书馆用于这些东西。
任何方式我都会很乐意为你提供任何帮助。可能是我只需要一些新的想法来为谷歌提供一个正确的关键字; P 编辑:我的服务器在Linux上运行。
如果您的服务器正在运行linux,则 在Windows上,您可以使用脚本和计划任务执行类似操作。 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. 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. EDIT: My server runs on linux. If your server is running linux, a On Windows, you'd do something similar with a script and a scheduled task. 这篇关于从网络服务器自动删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! cron
作业是最佳选择。只需编写一个脚本来检查您提到的条件(使用例如 stat
和其他一些工具),并删除文件(如果适用),并将 crond
每24小时运行一次。 下面是对 cron $ c的简短介绍
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 ;Pcron
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
.