简单任务:
将目录的所有内容移动c:\Users\files\Desktop\test 2到c:\Users\files\Desktop\test 1
C:\admin\temp>robocopy "c:\Users\files\Desktop\test 2" "c:\Users\files\Desktop\test" *.* /S /MOVE
Run Code Online (Sandbox Code Playgroud)
听起来很合理,但现在,该目录也c:\Users\files\Desktop\test 2被删除了。是否有一个开关可以只移动内容而不删除目录本身?
我想控制这样的 bash 脚本:
#!/bin/sh
USER1=_parsefromfile_
HOST1=_parsefromfile_
PW1=_parsefromfile_
USER2=_parsefromfile_
HOST2=_parsefromfile_
PW2=_parsefromfile_
imapsync \
--buffersize 8192000 --nosyncacls --subscribe --syncinternaldates --IgnoreSizeErrors \
--host1 $HOST1 --user1 $USER1 --password1 $PW1 --ssl1 --port1 993 --noauthmd5 \
--host2 $HOST2 --user2 $USER2 --password2 $PW2 --ssl2 --port2 993 --noauthmd5 --allowsizemismatch
Run Code Online (Sandbox Code Playgroud)
使用来自控制文件的参数,如下所示:
host1 user1 password1 host2 user2 password2
anotherhost1 anotheruser1 anotherpassword1 anotherhost2 anotheruser2 anotherpassword2
Run Code Online (Sandbox Code Playgroud)
其中每一行代表脚本的一次运行,其中提取了参数并制成变量。
这样做的最优雅的方式是什么?
拍