It takes only three steps to select hundreds of files in a massive file!

  
Quickly select photos of all the students who have reported and studied locally from the electronic photo library of thousands of students. Do not do the rest, can you do it? This is the case. During the semester, nearly 1,000 students were admitted to the school, and each student enrolled had an electronic photo. However, after the start of the school, some students did not report to the school, and some of the students who were reported were arranged to study abroad. Now, the superior requires that the electronic photos of each student be uploaded in the student status management system. It is very difficult to re-collect the photos of the students. Therefore, the school decided to upload photos of existing students, but must remove unreported and photo of students studying abroad. The previously collected student photos are all stored in a folder (the folder is E:\\electronic photo), which is nearly a thousand copies. The photos are named after the ID number, as shown in Figure 1. Now it is necessary to screen out hundreds of files from the “IDS number” in the new student registration form.xls” Now, you should filter out the photo files of the listed people in the spreadsheet and delete the unused files. To do this, some people think of the search method, but this method is too time consuming. Is there a better way? The method is yes. First, the implementation of the first step: list the file name. Use the DOS command to list the file names of all photo files to form a text file, and then copy the contents of the text file into the Excel table. Step 2: Compare. Compare with the ID number in the student registration form, and then sort the documents that match the non-conformity by sorting, and select the file names that do not match; Step 3: Use the DOS command to delete all non-conforming files. Second, the specific implementation of the first step: get the file name of all files 1. Open the "Electronic Photo" folder, enter "ld:; c: \\ windows \\ system32 \\ cmd. exe" in the address bar (if it is Windows 7 system Just enter “cmd”). 2. Enter the command: “DIR /O /B >LIST.TXT”, press Enter. The meaning of this command is: the name of all the files in the folder is transferred to the LIST.TXT text file. 3. Go back to the Windows interface and open the “E:\\E-Photos” folder. You will find a file LIST.TXT in the folder and open the file. The result is shown in Figure 2. 4. In LIST.TXT, use the find and replace method to delete all “.jpg”, as shown in Figure 3. Step 2: Data Comparison 1. Open the “New Student Registration Form.xls”. 2. Copy everything in “LIST.TXT” and paste it into the Excel sheet. Note: Before pasting, you must first select the column to paste the data, and set its number format to the “Text” type. Otherwise, an error will occur after pasting. 3. In the B1 cell, insert the function “=VLOOKUP(A1,[new registration form.xls]sheet1!$A:$A,1,0)”, press Enter to confirm, this cell is in this The function of the function is: in the column A of the “new registration form.xls” sheet1 worksheet (this area), find the same content as the A1 cell, if found, the content of the first column of the area is displayed in In the current cell, the last digit in parentheses <0&0&quo;; indicates that the search method is an exact search, otherwise the error message <;#N/A” is displayed. Note: The content you are looking for must be in the first column of the selected area, otherwise you will not find it. (The VLOOKUP function can be manipulated through a dialog box in the "Find and Reference" category. 4. Double-click the fill handle of the B1 cell to copy the formula. 5. Click the cell with data in column B and click the “sort sorting” button. The result is shown in Figure 4, where <quo;#N/A” indicates that it was not found. 6. Select the column A data that is not found, that is, the cell after “A469” in Figure 4, and copy it to column A of the blank table. 7. In the C1 cell, type “=A1&".jpg"”, that is, add “.jpg” to the back of the A1 cell, double-click the fill handle of the C1 cell, and copy the formula of C1. Go to the other cells in column C. 8. Enter del in cell B1 to copy the contents of B1 to the other cells in column B. The result is shown in Figure 5. Step 3: Delete all non-conforming files 1. Copy the contents of the B and C columns, paste them into Notepad, and save the file as del.bat (bat is the batch file, del is the meaning of deleting the file, in &ldquo ;Save as & rdquo; dialog box, & ldquo; file type & rdquo; to select “ all files & rdquo;), save the location as “ electronic photo & rdquo; folder. 2. Open the “Electronic Photo” folder and double-click del.bat. The system will automatically delete all files that do not meet the requirements, leaving the required files. Note: Files deleted in this way will not enter the Recycle Bin and therefore cannot be recovered. This article comes from [System Home] www.xp85.com
Copyright © Windows knowledge All Rights Reserved