You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

sync.html 3.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  5. <title>Sync Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="get">Sync</a></h2>
  9. <p><em>Since Ant 1.6</em></p>
  10. <h3>Description</h3>
  11. <p>Synchronize a target directory from the files defined in one or
  12. more filesets.</p>
  13. <p>Any file in the target directory that has not been matched by at
  14. least one of the nested filesets gets removed. I.e. if you exclude a
  15. file in your sources and a file of that name is present in the target
  16. dir, it will get removed from the target.</p>
  17. <h3>Parameters</h3>
  18. <table border="1" cellpadding="2" cellspacing="0">
  19. <tr>
  20. <td valign="top"><b>Attribute</b></td>
  21. <td valign="top"><b>Description</b></td>
  22. <td align="center" valign="top"><b>Required</b></td>
  23. </tr>
  24. <tr>
  25. <td valign="top">todir</td>
  26. <td valign="top">the target directory to sync with the filesets</td>
  27. <td align="center" valign="top">Yes</td>
  28. </tr>
  29. <tr>
  30. <td valign="top">overwrite</td>
  31. <td valign="top">Overwrite existing files even if the destination
  32. files are newer.</td>
  33. <td valign="top" align="center">No; defaults to false.</td>
  34. </tr>
  35. <tr>
  36. <td valign="top">includeEmptyDirs</td>
  37. <td valign="top">Copy any empty directories included in the FileSet(s).
  38. </td>
  39. <td valign="top" align="center">No; defaults to true.</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">failonerror</td>
  43. <td valign="top">Log a warning message, but do not stop the build,
  44. when one of the nested filesets points to a directory that
  45. doesn't exist.
  46. </td>
  47. <td valign="top" align="center">No; defaults to true.</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">verbose</td>
  51. <td valign="top">Log the files that are being copied.</td>
  52. <td valign="top" align="center">No; defaults to false.</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">granularity</td>
  56. <td valign="top">The number of milliseconds leeway to give before
  57. deciding a file is out of date. This is needed because not every
  58. file system supports tracking the last modified time to the
  59. millisecond level. Default is 0 milliseconds, or 2 seconds on DOS
  60. systems. This can also be useful if source and target files live
  61. on separate machines with clocks being out of sync. <em>since Ant
  62. 1.6.2</em>.</td>
  63. <td valign="top" align="center">No.</td>
  64. </tr>
  65. </table>
  66. <h3>Parameters specified as nested elements</h3>
  67. <h4>fileset</h4>
  68. <p><a href="../CoreTypes/fileset.html">FileSet</a>s are used to select
  69. sets of files and directories.</p>
  70. <h4>preserveInTarget</h4>
  71. <p>Specifies files or directories that should be kept in the target
  72. directory even if they are not present in one of the source
  73. directories.</p>
  74. <p>This nested element is like a <a
  75. href="../CoreTypes/fileset.html">FileSet</a> except that it doesn't
  76. support the dir attribute and the usedefaultexcludes attribute
  77. defaults to false.</p>
  78. <h3>Examples</h3>
  79. <blockquote><pre>
  80. &lt;sync todir=&quot;site&quot;&gt;
  81. &lt;fileset dir=&quot;generated-site&quot;/&gt;
  82. &lt;/sync&gt;
  83. </pre></blockquote>
  84. <p>overwrites all files in <em>site</em> with newer files from
  85. <em>generated-site</em>, deletes files from <em>site</em> that are not
  86. present in <em>generated-site</em>.</p>
  87. <blockquote><pre>
  88. &lt;sync todir=&quot;site&quot;&gt;
  89. &lt;fileset dir=&quot;generated-site&quot;/&gt;
  90. &lt;preserveintarget&gt;
  91. &lt;include name=&quot;**/CVS/**&quot;/&gt;
  92. &lt;/preserveintarget&gt;
  93. &lt;/sync&gt;
  94. </pre></blockquote>
  95. <p>overwrites all files in <em>site</em> with newer files from
  96. <em>generated-site</em>, deletes files from <em>site</em> that are not
  97. present in <em>generated-site</em> but keeps all files in any
  98. <em>CVS</em> sub-directory.</p>
  99. <hr>
  100. <p align="center">Copyright &copy; 2003-2005 The Apache Software Foundation. All rights
  101. Reserved.</p>
  102. </body>
  103. </html>