Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: r603?


From   Dimitri Szerman <dimitrijoe@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: r603?
Date   Wed, 13 Oct 2010 09:32:49 +0100

Hello,

I am using Stata to back up millions of files. Here's what I do


	! dir "mydir\*.csv" /a-d /b  > filelist.txt 		// create list of csv
files to be imported

	file open LIST using "filelist.txt", read
	file read LIST line
	while r(eof)==0 {
		copy "mydir\\`line'" "myotherdir", replace
		file read LIST line
		}
	file close LIST

This works for many instances of "mydir" and "myotherdir". However,
sometimes, for reasons obscure to me, I get the following error
message

file XYZ.csv could not be opened.
r603

Two things make this error message really strange to me. First, it
happens in the middle of the loop, ie, after having copied 1000s of
files to the destination. Secondly, if I type

copy "mydir\XYZ.csv" "myotherdir", replace

right after the error the operation carries through. Note, this line
is virtually identical to the one in the loop.

My Stata version is Stata11SE, and I'm running Windows XP and the
destination directory is a external Western Digital HD.

Just in case someone is wondering, I am using Stata to copy files
because it happens to be much more stable than DOS xcopy command. DOS
xcopy command would simply crash my computer, as I have millions of
files and xcopy appears to do bulky operations, while my Stata code
does one file at a time.

So, any thoughts on why I might be getting this error message and how
to go around it, would be much appreciated.

Many thanks,
Dimitri
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index