0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

robocopyの/mirと/Eの動き

Posted at

/mirは、dstにあってsrcに無いファイルは消える
/Eは、dstにあってsrcに無いファイルも残る

では、コピー対象を絞った時、対象外のファイルはどうなるか、下記で実験した。

orgDir
  |-a.txt
  |-b.txt
  |-dirA
     |-c.txt
     |-d.exe
     |-e.pdf

のようなディレクトリにたいして

robocopy orgDir editDir *.txt /mir
robocopy orgDir dstDir1 /mir
robocopy orgDir dstDir2 /mir

を実行。editDirで

  • a.txtを編集
  • b.txtを削除

を行い、さらに

robocopy editDir dstDir1 *.txt /mir
robocopy editDir dstDir2 *.txt /E

を実行。

この結果、dstDir1とdstDir2は

dstDir1
  |-a.txt
  |-dirA
     |-c.txt
     |-d.exe
     |-e.pdf
dstDir2
  |-a.txt
  |-b.txt
  |-dirA
     |-c.txt
     |-d.exe
     |-e.pdf
  • a.txtの変更は、どちらにも
  • dstDir1では、b.txtは消えている
  • dstDir2では、b.txtは消えていない(/Eだから)
  • いずれも、「.txt」以外には作用していない
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?