| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="81help.css?format=raw" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Find and Copy Files</title></head><body><table style="margin-top:-1em; margin-bottom:0; padding:0; margin-left:-1em"><tr><td style="background:white"><img width="875" height="70" alt="ArcToolbox banner" src="AHBanner_ArcToolbox.gif?format=raw" /></td></tr></table><h1>Find and Copy Files</h1><p></p><p>Finds and copies files in a directory.</p><br /><p><h2><img width="11" height="11" border="0" src="sm_arrow_down.gif?format=raw" /> Command line syntax</h2></p><div Class="expand" id="id103145">FileFindAndCopy_GeoEco <inputDirectory> <outputDirectory> {wildcard} {searchTree} {minSize} {maxSize} {minDateCreated} {maxDateCreated} {minDateModified} {maxDateModified} {destinationFilePythonExpression} {modulesToImport;modulesToImport...} {skipExisting} <br /><br /><b>Parameters</b><br /><table width="100%" border="0" cellpadding="5"><tbody><tr><th width="40%"><b>Expression</b></th><th width="60%"><b>Explanation</b></th></tr><tr><td class="info"><inputDirectory></td><td class="info" align="left"><p>Directory to search.</p></td></tr><tr><td class="info"><outputDirectory></td><td class="info" align="left"><p>Directory to receive copies of the files.</p></td></tr><tr><td class="info">{wildcard}</td><td class="info" align="left"><p>UNIX-style "glob" wildcard expression specifying the pathnames to |
|---|
| 4 | find.</p><p>The glob syntax supports the following patterns:</p><ul><li><p>? - matches any single character</p></li></ul><ul><li><p>* - matches zero or more characters</p></li></ul><ul><li><p>[seq] - matches any single character in <i>seq</i></p></li></ul><ul><li><p>[!seq] - matches any single character not in <i>seq</i></p></li></ul><p><i>seq</i> is one or more characters, such as abc. You may specify |
|---|
| 5 | character ranges using a dash. For example, a-z0-9 specifies all of |
|---|
| 6 | the characters in the English alphabet and the decimal digits 0 |
|---|
| 7 | through 9.</p><p>You may specify subdirectories in the glob expression. For example, |
|---|
| 8 | the expression cruise*/sst* will find all paths beginning with sst |
|---|
| 9 | that are contained in directories beginning with cruise.</p><p>The operating system determines whether / or \ is used as the |
|---|
| 10 | directory separator. On Windows, both will work. On most flavors of |
|---|
| 11 | UNIX, / must be used.</p><p>The operating system determines if matching is case sensitive. On |
|---|
| 12 | Windows, matching is case-insensitive. On most flavors of UNIX, |
|---|
| 13 | matching is case-sensitive.</p></td></tr><tr><td class="info">{searchTree}</td><td class="info" align="left"><p>If True, subdirectories will be searched.</p></td></tr><tr><td class="info">{minSize}</td><td class="info" align="left"><p>Minimum size, in bytes, of files to find. If provided, only files |
|---|
| 14 | that are this size or larger will be found.</p></td></tr><tr><td class="info">{maxSize}</td><td class="info" align="left"><p>Maximum size, in bytes, of files to find. If provided, only files |
|---|
| 15 | that are this size or smaller will be found.</p></td></tr><tr><td class="info">{minDateCreated}</td><td class="info" align="left"><p>Minimum creation date, in the local time zone, of the files to |
|---|
| 16 | find, as reported by the operating system. If provided, only files |
|---|
| 17 | that were created on or after this date will be found. You may provide |
|---|
| 18 | a date with or without a time. If you do not provide a time, it is |
|---|
| 19 | assumed to be midnight.</p></td></tr><tr><td class="info">{maxDateCreated}</td><td class="info" align="left"><p>Maximum creation date, in the local time zone, of the files to |
|---|
| 20 | find, as reported by the operating system. If provided, only files |
|---|
| 21 | that were created on or before this date will be found. You may |
|---|
| 22 | provide a date with or without a time. If you do not provide a time, |
|---|
| 23 | it is assumed to be midnight.</p></td></tr><tr><td class="info">{minDateModified}</td><td class="info" align="left"><p>Minimum modification date, in the local time zone, of the files to |
|---|
| 24 | find, as reported by the operating system. If provided, only files |
|---|
| 25 | that were modified on or after this date will be found. You may |
|---|
| 26 | provide a date with or without a time. If you do not provide a time, |
|---|
| 27 | it is assumed to be midnight.</p></td></tr><tr><td class="info">{maxDateModified}</td><td class="info" align="left"><p>Maximum modification date, in the local time zone, of the files to |
|---|
| 28 | find, as reported by the operating system. If provided, only files |
|---|
| 29 | that were modified on or before this date will be found. You may |
|---|
| 30 | provide a date with or without a time. If you do not provide a time, |
|---|
| 31 | it is assumed to be midnight.</p></td></tr><tr><td class="info">{destinationFilePythonExpression}</td><td class="info" align="left"><p>Python expression used to calculate the absolute path of the |
|---|
| 32 | destination file. The expression may be any Python statement |
|---|
| 33 | appropriate for passing to the eval function and must return a Unicode |
|---|
| 34 | string. The expression may reference the following variables:</p><ul><li><p>directoryToSearch - the value provided for the directory to search |
|---|
| 35 | parameter</p></li></ul><ul><li><p>destinationDirectory - the value provided for the destination |
|---|
| 36 | directory parameter</p></li></ul><ul><li><p>sourceFile - the absolute path of the source file</p></li></ul><p>The default expression:</p><dl><dt></dt><dd><pre>os.path.join(destinationDirectory, sourceFile[len(directoryToSearch)+1:])</pre></dd></dl><p>stores the file in the destination directory at the same relative |
|---|
| 37 | location as it appears in the directory to search. The destination |
|---|
| 38 | path is calculated by stripping the directory to search from the |
|---|
| 39 | source path and replacing it with the destination directory.</p><p>For more information on Python syntax, please see the <a href="http://www.python.org/doc/">Python |
|---|
| 40 | documentation</a>.</p></td></tr><tr><td class="info">{modulesToImport;modulesToImport...}</td><td class="info" align="left"><p>Python modules to import prior to evaluating the expression. If |
|---|
| 41 | you need to access Python functions or classes that are provided by a |
|---|
| 42 | module rather than being built-in to the interpreter, list the module |
|---|
| 43 | here. For example, to be able to use the datetime class in your |
|---|
| 44 | expression, list the datetime module here. In your expression, you |
|---|
| 45 | must refer to the class using its fully-qualified name, |
|---|
| 46 | datetime.datetime.</p></td></tr><tr><td class="info">{skipExisting}</td><td class="info" align="left"><p>If True, copying will be skipped for destination files that already exist.</p></td></tr></tbody></table></div><p><h2><img width="11" height="11" border="0" src="sm_arrow_down.gif?format=raw" /> Scripting syntax</h2></p><div Class="expand" id="TEST">FileFindAndCopy_GeoEco (inputDirectory, outputDirectory, wildcard, searchTree, minSize, maxSize, minDateCreated, maxDateCreated, minDateModified, maxDateModified, destinationFilePythonExpression, modulesToImport, skipExisting) <br /><br /><b>Parameters</b><br /><table width="100%" border="0" cellpadding="5"><tbody><tr><th width="40%"><b>Expression</b></th><th width="60%"><b>Explanation</b></th></tr><tr><td class="info">Directory to search (Required) </td><td class="info" align="left"><p>Directory to search.</p></td></tr><tr><td class="info">Destination directory (Required) </td><td class="info" align="left"><p>Directory to receive copies of the files.</p></td></tr><tr><td class="info">Wildcard expression (Optional) </td><td class="info" align="left"><p>UNIX-style "glob" wildcard expression specifying the pathnames to |
|---|
| 47 | find.</p><p>The glob syntax supports the following patterns:</p><ul><li><p>? - matches any single character</p></li></ul><ul><li><p>* - matches zero or more characters</p></li></ul><ul><li><p>[seq] - matches any single character in <i>seq</i></p></li></ul><ul><li><p>[!seq] - matches any single character not in <i>seq</i></p></li></ul><p><i>seq</i> is one or more characters, such as abc. You may specify |
|---|
| 48 | character ranges using a dash. For example, a-z0-9 specifies all of |
|---|
| 49 | the characters in the English alphabet and the decimal digits 0 |
|---|
| 50 | through 9.</p><p>You may specify subdirectories in the glob expression. For example, |
|---|
| 51 | the expression cruise*/sst* will find all paths beginning with sst |
|---|
| 52 | that are contained in directories beginning with cruise.</p><p>The operating system determines whether / or \ is used as the |
|---|
| 53 | directory separator. On Windows, both will work. On most flavors of |
|---|
| 54 | UNIX, / must be used.</p><p>The operating system determines if matching is case sensitive. On |
|---|
| 55 | Windows, matching is case-insensitive. On most flavors of UNIX, |
|---|
| 56 | matching is case-sensitive.</p></td></tr><tr><td class="info">Search directory tree (Optional) </td><td class="info" align="left"><p>If True, subdirectories will be searched.</p></td></tr><tr><td class="info">Minimum size (Optional) </td><td class="info" align="left"><p>Minimum size, in bytes, of files to find. If provided, only files |
|---|
| 57 | that are this size or larger will be found.</p></td></tr><tr><td class="info">Maximum size (Optional) </td><td class="info" align="left"><p>Maximum size, in bytes, of files to find. If provided, only files |
|---|
| 58 | that are this size or smaller will be found.</p></td></tr><tr><td class="info">Minimum creation date (Optional) </td><td class="info" align="left"><p>Minimum creation date, in the local time zone, of the files to |
|---|
| 59 | find, as reported by the operating system. If provided, only files |
|---|
| 60 | that were created on or after this date will be found. You may provide |
|---|
| 61 | a date with or without a time. If you do not provide a time, it is |
|---|
| 62 | assumed to be midnight.</p></td></tr><tr><td class="info">Maximum creation date (Optional) </td><td class="info" align="left"><p>Maximum creation date, in the local time zone, of the files to |
|---|
| 63 | find, as reported by the operating system. If provided, only files |
|---|
| 64 | that were created on or before this date will be found. You may |
|---|
| 65 | provide a date with or without a time. If you do not provide a time, |
|---|
| 66 | it is assumed to be midnight.</p></td></tr><tr><td class="info">Minimum modification date (Optional) </td><td class="info" align="left"><p>Minimum modification date, in the local time zone, of the files to |
|---|
| 67 | find, as reported by the operating system. If provided, only files |
|---|
| 68 | that were modified on or after this date will be found. You may |
|---|
| 69 | provide a date with or without a time. If you do not provide a time, |
|---|
| 70 | it is assumed to be midnight.</p></td></tr><tr><td class="info">Maximum modification date (Optional) </td><td class="info" align="left"><p>Maximum modification date, in the local time zone, of the files to |
|---|
| 71 | find, as reported by the operating system. If provided, only files |
|---|
| 72 | that were modified on or before this date will be found. You may |
|---|
| 73 | provide a date with or without a time. If you do not provide a time, |
|---|
| 74 | it is assumed to be midnight.</p></td></tr><tr><td class="info">Destination file Python expression (Optional) </td><td class="info" align="left"><p>Python expression used to calculate the absolute path of the |
|---|
| 75 | destination file. The expression may be any Python statement |
|---|
| 76 | appropriate for passing to the eval function and must return a Unicode |
|---|
| 77 | string. The expression may reference the following variables:</p><ul><li><p>directoryToSearch - the value provided for the directory to search |
|---|
| 78 | parameter</p></li></ul><ul><li><p>destinationDirectory - the value provided for the destination |
|---|
| 79 | directory parameter</p></li></ul><ul><li><p>sourceFile - the absolute path of the source file</p></li></ul><p>The default expression:</p><dl><dt></dt><dd><pre>os.path.join(destinationDirectory, sourceFile[len(directoryToSearch)+1:])</pre></dd></dl><p>stores the file in the destination directory at the same relative |
|---|
| 80 | location as it appears in the directory to search. The destination |
|---|
| 81 | path is calculated by stripping the directory to search from the |
|---|
| 82 | source path and replacing it with the destination directory.</p><p>For more information on Python syntax, please see the <a href="http://www.python.org/doc/">Python |
|---|
| 83 | documentation</a>.</p></td></tr><tr><td class="info">Python modules to import (Optional) </td><td class="info" align="left"><p>Python modules to import prior to evaluating the expression. If |
|---|
| 84 | you need to access Python functions or classes that are provided by a |
|---|
| 85 | module rather than being built-in to the interpreter, list the module |
|---|
| 86 | here. For example, to be able to use the datetime class in your |
|---|
| 87 | expression, list the datetime module here. In your expression, you |
|---|
| 88 | must refer to the class using its fully-qualified name, |
|---|
| 89 | datetime.datetime.</p></td></tr><tr><td class="info">Skip existing outputs (Optional) </td><td class="info" align="left"><p>If True, copying will be skipped for destination files that already exist.</p></td></tr></tbody></table></div></body></html> |
|---|