Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<h2>RusF. Note:</h2> <p>Using XCOPY, it is no longer possible to use wildcarding in the file name for directories, and then just have a group of similarly named directories copied over to an archive or network structure.</p> <p>(Hint: You want to do this all the time, if you are managing big wads of data. Eg. Video or movie files (where many files may be associated with the production. Or, price history data files, in various formats, or database files from various research projects, or experimental work.)</p> <p>I am sure I used to be able to do this with older XCOPY, but with upgrades (for security), wildcards in the file name, do not work right (ie. you can build a directory structure, with the "/t" option, but you cannot get the damn files within the directories to migrate! Damned annoying.)</p> <p>Well, we here at the Farm, always get to a solution. Even if it takes using a .44 magnum or a Styer 50. :)</p> <p>So, heres what I came up with:</p> <p>Assume you have a bunch of directories called "Fark_1, Fark_2, Fark-Special, Fark_in_the_Park, Fark99... " and so on.</p> <p>If all these "Fark..." directories exist on a C:\ disk, and you want to migrate a copy of this sub-structure to the archive disk on the network (say it is called: "h:") you can just do the following:</p> <p>Run a FOR DO from Windows (MS-DOS) command prompt:</p> <pre><code> c:\&gt; XCOPY fark* h: /s /e /f /t The /s /e are for copying subdirs and empty directories, the /f says to show the files, and the /t says to only copy the disk directories. No XCOPY option seems to exist anymore to copy the disk structure AND the files in the directories. </code></pre> <p>To get the files to copy over, you then do the following, also from Windows command prompt:</p> <pre><code> FOR /d %a in (fark*) DO XCOPY "%a" h:%a\ /s /e /f /h /k /y The /d says we are using directory names. The %a is the variable name, substituted into the command script for XCOPY. Make sure to use whatever logical name or drive letter you have for your archive structure. (ie. don't use h: in the above command, unless you have mapped h: to the place on the network where you want to copy your files to.) And note, the /y option means overwrite any files already there. </code></pre> <p>Yes, this is old-school unix/dos stuff, but it works, and you can put it into a batch job. And you can avoid being the mouseboy to get the work done. (Point, click, grunt, curse. Repeat. The canonical process for using a GUI, right?) Now, there are lots of fancy ways to do this. And various utils like Robocopy, XXcopy and so on. But this gets it done, and if you have any copy of Windows, you probably already have the XCOPY and FOR-DO thingys. All the best. Oh, if you slot the two commands into a batch job, then you have to adjust the syntax for two levels of command substitution (I think is the correct term).</p> <p>batch example:</p> <pre><code> REM --- copy the "fark*" files to the archive disk h: @echo off REM --- create/update the structure xcopy fark* h: /s /e /f /t REM --- copy over the fark* dirs, and all associated subdirs for /d %%a in (fark*) do xcopy "%%a" "h:%%a\" /s /e /f /h /k /y </code></pre> <ul> <li>Rus Future April 18, 2012</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload