Recently, due to the Mesis database automatic station data, it is necessary to copy the regional automatic station data files from the Cmacast broadcast directory L1 for storage. In the actual operation encountered a few problems, hereby make a memo to find later.
Problem 1:micdb specified source directory as long as there are files on the processing, the library into the program is very resource-intensive, with the PC processing to pay attention to efficiency, it is best to put the latest files at a time to reduce the duplication of processing.
Problem 2:cmacast broadcast directory L1 file too much, 3 days have more than 490,000 files, light open the directory will read n minutes, the National Bureau of Information Center technicians are eating feces. The original use of sceondcopy copy function is very powerful, you can only copy the latest files, but the number of files on this directory is too large, the last implementation. (Newzfile from SJK copy can be used secondcopy)
To solve the above 2 problems, the use of Xcopy first L1 directory of the province automatically copy the file, placed in the D:\AWS\ZFILE (scheduled task implementation), and then use Scondcopy to D:\AWS\ZFILE the latest files to D:\Program files\ Read in Micdb\tempdata\zfile for micdb into the library.
xcopy used the/d:mm-dd-yyyy parameter, that is, only the file after the specified date, the date of the day to generate, using the%date% to obtain the system date, if the general Chinese XP system, the date format is YYYY-MM-DD, So the date format of the United States was reconditioned in the form of an intercept string. For example:%date:~0,4% that the interception from the No. 0 bit to intercept the length of 4 characters to get yyyy (year), such as:%date:~5,5% said interception from the 5th bit to intercept the length of 5 characters to get MM-DD (month-day)
In order to facilitate users and their browsing cloud habitat special will be content, easy to learn
command to get system time in DOS
Copy Code code as follows:
Output:
Intercept 4-digit year variables after reading system date (China date format year-month-day)
Set nian=%date:~0,4$
Test
Copy Code code as follows:
Output:
Intercept the 2-digit month variable after reading the system date
Set yue=%date:~5,2%
Test:
Copy Code code as follows:
Output:
Intercept 2-bit day variables after reading the system date
Set ri=%date:~8,2%
Test:
Copy Code code as follows:
Output:
Reshape the U.S. date variable format "month-day-year", only select files that copy the current date
Copy Code code as follows:
xcopy \\172.22.68.4\sjk\zp\*.* e:\test/d:%yue%-%ri%-%nian%