Sometimes, your folders can get so cluttered with all the file types in the world. A prime example is the Downloads folder, where you download and download and never care about organizing. Wouldn't it be great if you double-clicked somewhere and automatically had all your messy files neatly sorted and moved into their respective folders based on their respective extensions? So, get ready to embrace the beautiful! We are here to guide you on how to accomplish this trick with the help of a simple batch script.
Step 1: Navigate to the parent folder that contains all the files that need to be sorted and moved. This can be any folder of your choice, including the "Downloads" folder.
In the example below, in my parent folder I have a number of files with various extensions.
Step 2: Next, right-click the blank area and click "New" Options and click "Text Document" Options.
Step 3: You now need to double-click on the new text document you just created. This will open the newly created text document in Notepad for editing.
Step 4: When Notepad starts to open, copy and paste the following script onto it. @echo 关闭rem thegeekpage.com对于 (".\*") 中的 %%a 执行 ( 如果 "%%~xa" NEQ "" 如果 "%%~dpxa" NEQ "%~dpx0" ( 如果不存在 "%%~xa" mkdir "%%~xa" ( 移动 "%%a" "%%~dpa%%~xa\" ) ))
After copying the above script,
press the CTRL S key at the same time to save the file.After saving, you can close the file.
Explanation:This script iterates through all files in the parent folder. The batch script we created is ignored, sorting and moving are not considered.
: After that, go back to the parent folder, click on the saved text file and press the F2 keyRename . You can provide any name according to your choice, but make sure to specify the extension of the file as bat, after . (dot). Click elsewhere when finished naming. Note:
Having the extension as bat is the most important part.
Step 6: When you click elsewhere, you will see the following Rename confirmation window. Click the Yes button to continue.
Step 7: Next, you can double-click the batch file to execute it. Be careful with this step, it cannot be recovered.
Step 8: Viola! You can now see that all the files in the parent folder are now neatly sorted and moved to their respective folders based on their extensions. enjoy!
The above is the detailed content of How to sort and move files by extension on Windows. For more information, please follow other related articles on the PHP Chinese website!