linux - 删除 ftp 服务器上早于 x 天的文件的 Shell 脚本

标签 linux unix sh

有一个 shell 脚本,可以连接并将文件放到 ftp 服务器。 现在试图从 ftp 服务器上的同一目录中删除 2 天前的文件。 尝试使用 find 命令,但得到的是?无效命令 找到 ./*.txt -mtime +2 -exec rm {}\;

......
ftp -nv <<! >> $FTP_LOG 2>> $FTP_LOG

open xxx
user userid pwd

lcd $FILES_DIR

cd /yyy

put $File1 $File1
put $File2 $File2

find ./*.txt -mtime +2 -exec rm {} \;

quit
!
......

我还能尝试什么??在这方面需要帮助。

最佳答案

我遇到了同样的错误,当使用ftp时,有些linux版本无法识别 字符“*”,将其替换为特定的字符。

关于linux - 删除 ftp 服务器上早于 x 天的文件的 Shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35514184/

相关文章:

bash - Unix:If/then 语句始终为假

linux - 为什么 "sort file1 > file1"不起作用?

bash - 您应该在 shell 脚本中更改当前目录吗?

linux - 如何获得主要的:minor for a platform_driver

linux - 将 .txt 文件中的输入用于 if 命令 shell linux

Linux shell 脚本 - 将尾值分配给变量?

sql-server - Ubuntu 14.04 + Lamp 1.2.4 mssql_connect 不工作

unix - Cygwin:无法找到 Java 路径。

linux - Manage ctrl+z and bg or & signal in shell script - (shell脚本中的后台进程)

带有 --git-dir= 的 git 结果为 'not a git repository'