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,
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.
- The script gets each file and checks its extension.
- The script then checks to see if a folder with the same name as the current file's extension exists in the parent folder. If the folder does not exist, create it.
- Once a folder is created or found to exist, the file will be moved to it.
- Repeat steps 2 to 5 until all files have been checked and moved as necessary.
: 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.
: When you click elsewhere, you will see the following Rename confirmation window. Click the Yes button to continue.
: Next, you can double-click the batch file to execute it. Be careful with this step, it cannot be recovered.
: 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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
