我想将一个目录(pscp)从Windows服务器复制到Linux服务器 Linux 服务器上的目标地名每次都必须是新的。当我运行以下命令时,
> pscp -p -l root
> -pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/$(date)
命令替换 $(date) 不起作用。 谁能建议我如何运行这个?
最佳答案
尝试以下操作:
:: This is stripping the `/` and `Day of the Week` from the date
set target_date=%date:/=-%
set target_date=%target_date:* =%
:: Copying the directory to the linux server based on this system's date
pscp -p -l root
-pw mypassword -r C:\ProgramFiles\Mybackups\root@linux_server:/root/mywindowsbackups/%target_date%
关于linux - 将 pscp 文件从 Windows 服务器复制到远程 Linux 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23718266/