Sunday, 24 September 2017

How To Sort Files Into Folders By Filetype in Windows

Hello Again! Today I am going to give you a little tip on tidying up your cluttered windows desktop/downloads folder. If you are a messy person who downloads or saves images, pdf and every other file on your desktop for ease of access and forgets to clean up after, you are not alone! My desktop is a mess most of the time and I hardly get time to clean it up! Same goes for my downloads folder where I have movies, music or even documents lying unattended. So, I did some research and found this awesome trick!

I am going to show you how to sort files in a folder into subfolders based on filetype in one click. After effect would be a bunch of folders like this with all your files sorted into respective folders! Now you can move them wherever you want.


Here is how to do it:

Open Windows Notepad and paste the below code:

@echo off
rem For each file in your folder
for %%a in (".\*") do (
rem check if the file has an extension and if it is not our script
if "%%~xa" NEQ ""  if "%%~dpxa" NEQ "%~dpx0" (
rem check if extension folder exists, if not it is created
if not exist "%%~xa" mkdir "%%~xa"
rem Move the file to directory
move "%%a" "%%~dpa%%~xa\"
))
And save as FolderByType.bat 
While saving the file, make sure you select type as "all files" like shown below:

Now, place the bat file in whichever folder you'd like to clean up. Double click and wait for the magic!

Caution: Don't run this batch file in system folders, root folders or installation directories. I suggest you use it in Downloads folder or Desktop where you have a large number of unsorted files. 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...