将 find 与 curl 组合使用
我使用下面的代码将数据发送到我的 NAS。正在创建的目录以句点结尾。我不想最后有句号。我怎样才能防止这种情况。 我的 NAS 上的目录现在如下: 目录:InluxDB。 子目录:(日期)为 07-03-2022
TEMPDIR="/tmp"
DESTDIRNAS="/Backups/InfluxDB"
DATE="$(date +%d-%m-%Y)"
BACKUPDIR="/tmp/influxdb"
cd $BACKUPDIR
find -type f -exec curl -u "USER:PASSWORD" --ftp-create-dirs -T {} "ftp://192.168.1.20/$DESTDIRNAS"{} \;
#delete tmp folder
rm -rf $BACKUPDIR
I use the code below to send data to my NAS. The directory being created ends with a period. I don't want a period at the end. How can I prevent this.
The dir on my NAS is now as follows:
Dir: InluxDB.
Subdir: (date) as 07-03-2022
TEMPDIR="/tmp"
DESTDIRNAS="/Backups/InfluxDB"
DATE="$(date +%d-%m-%Y)"
BACKUPDIR="/tmp/influxdb"
cd $BACKUPDIR
find -type f -exec curl -u "USER:PASSWORD" --ftp-create-dirs -T {} "ftp://192.168.1.20/$DESTDIRNAS"{} \;
#delete tmp folder
rm -rf $BACKUPDIR
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使
find
输出具有完整/绝对路径,请使用find "$PWD" -type f
建议使用
curl
命令:至于获取最后一个目录
$BACKUPDIR
返回
influxdb
返回
/tmp
To make
find
output with full/absolute path usefind "$PWD" -type f
Suggesting the
curl
command:As for getting last directory in
$BACKUPDIR
Returns
influxdb
Return
/tmp