小编per*_*ler的帖子

Robocopy:如何移动目录的内容但保留目录

简单任务:

将目录的所有内容移动c:\Users\files\Desktop\test 2c:\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被删除了。是否有一个开关可以只移动内容而不删除目录本身?

windows robocopy

26
推荐指数
3
解决办法
20万
查看次数

使用外部文件中的变量控制 bash 脚本

我想控制这样的 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)

其中每一行代表脚本的一次运行,其中提取了参数并制成变量。

这样做的最优雅的方式是什么?

shell bash shell-scripting

8
推荐指数
1
解决办法
4万
查看次数

标签 统计

bash ×1

robocopy ×1

shell ×1

shell-scripting ×1

windows ×1