Created
          January 9, 2019 07:58 
        
      - 
      
 - 
        
Save sidward35/5dc4173ab1849f1e00fabadb84cb91dd to your computer and use it in GitHub Desktop.  
    Batch script that sorts files into folders by file type
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @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\" | |
| )) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment