@echo off set tmp=T3mp0r4ry GOTO ARGS :: Exclusions by File name.ext & by root folder at top for ease :: Execution done in SAFE Label, to allow exit /b to work properly & continue to cycle throughout the drive :SAFE set fnscr=Y IF "%fpc:~2%" == "\" (set fnsc=Y&&exit /b) IF "%fnc%" == "pagefile.sys" (set fnsc=Y&&exit /b) IF "%fnc%" == "swapfile.sys" (set fnsc=Y&&exit /b) IF "%fnc%" == "desktop.ini" (set fnsc=Y&&exit /b) IF "%fnc%" == "Thumbs.db" (set fnsc=Y&&exit /b) IF "%fnc:~-4%" == ".lnk" (set fnsc=Y&&exit /b) IF "%fnc:~-4%" == ".bat" (set fnsc=Y&&exit /b) IF "%fpc:~3,7%" == "WINDOWS" (set fnsc=Y&&exit /b) IF "%fpc:~3,7%" == "Program" (set fnsc=Y&&exit /b) IF "%fpc:~3,8%" == "Recovery" (set fnsc=Y&&exit /b) IF "%fpc:~3,1%" == "$" (set fnsc=Y&&exit /b) IF "%fpc:~3,6%" == "Config" (set fnsc=Y&&exit /b) IF "%fpc:~3,5%" == "Files" (set fnsc=Y&&exit /b) IF "%fpc:~3,25%" == "System Volume Information" (set fnsc=Y&&exit /b) IF "%fpc:~3,8%" == "OneDrive" (set fnsc=Y&&exit /b) IF "%fnsc%" == "Y" exit /b echo %fpc%%fnc% shifting IF NOT EXIST "%fpc%%csf%\" mkdir "%fpc%%csf%\" copy "%fpc%%fnc%" "%fpc%%csf%\" del /f "%fpc%%fnc%" move "%fpc%%csf%\%fnc%" "%fpc%" rmdir "%fpc%%csf%\" exit /b :ARGS ::One Time Prep and/or help arguments IF %1.==. GOTO REQU IF %1==help GOTO HLPO IF %1==drive GOTO DHE IF %1==path GOTO FHE IF %1==ex GOTO FIHE IF %1==temp GOTO CFH set dr=%1 set dr=%dr:~0,1% IF %dr% LEQ 9 ( echo Letters Only for Drive Selection && GOTO ELOP ) IF %2.==. GOTO REQU set pth=%2 :A21 IF %pth%.==. GOTO REQU IF %pth:~0,1%==/ (set pth=%pth:~1%&& GOTO A21 ) IF %pth:~-1%==/ (set pth=%pth:~0,-1%&& GOTO A21 ) IF %pth:~0,1%==\ (set pth=%pth:~1%&& GOTO A21 ) IF %pth:~-1%==\ (set pth=%pth:~0,-1%&& GOTO A21 ) IF "%pth:~0,1%" == " " (set pth=%pth:~1%&& GOTO A21 ) IF "%pth:~-1%" == " " (set pth=%pth:~0,-1%&& GOTO A21 ) IF %pth%==driveroot set fptc=%dr%:\ IF NOT %pth%==driveroot set fptc=%dr%:\%pth%\ IF %3.==. GOTO THIR IF %3==any GOTO THIR set ex=%3 :A31 IF %ex:~0,1%==. (set ex=%ex:~1%&& GOTO A31 ) IF %ex:~0,1%==* GOTO SERR set ex=*.%ex% GOTO SFR :THIR set ex=* :SFR set csf=%4 IF %4.==. set csf=%tmp% :A41 IF %csf:~0,1%==/ (set csf=%csf:~1%&& GOTO A41 ) IF %csf:~-1%==/ (set csf=%csf:~0,-1%&& GOTO A41 ) IF %csf:~0,1%==\ (set csf=%csf:~1%&& GOTO A41 ) IF %csf:~-1%==\ (set csf=%csf:~0,-1%&& GOTO A41 ) IF "%csf:~0,1%" == " " (set csf=%csf:~1%&& GOTO A41 ) IF "%csf:~-1%" == " " (set csf=%csf:~0,-1%&& GOTO A41 ) ::Start prep set fnsc=N set fnscr=N IF NOT EXIST %fptc% GOTO REQU %dr%: cd %fptc% for /r %%i in (%ex%) do ( set fnsc=N set fnscr=N set fnc=%%~nxi set fpc=%%~dpi Call :SAFE ) :REQU echo "Requires Valid Paramaters to be passed into the file as well." echo (Drive_Letter* // StartingFolder_Path* // File_Extenstion // Custom_TempFolder) echo Use ' MassShift help ' to get more info. echo Use switch command or LOWERCASE 'help' GOTO ELOP :HLPO echo Help for batch commands echo Paramater Order "(Drive_Letter* // StartingFolder_Path* // File_Extenstion // Custom_TempFolder) echo Default Hold folder for the 'Balancing' is %tmp% echo ' MassShift drive ' for Valid Drive leters echo ' MassShift path ' for Folder Path Formating echo ' MassShift ex ' for Valid inputs echo ' MassShift temp ' for Valid Temp folders GOTO ELOP :DHE echo REQUIRED echo Any Drive letter A-Z echo Formats C // C: // C:/ echo No Spaces GOTO ELOP :FHE echo REQUIRED echo Spaces are allowed within the folder name, not before or after echo To start at the root of a drive, use 'driveroot' [without the ''] for StartingFolder_Path. [will skip all files on the drive root] echo Use of " " is required around the entire Folder_Path input has spaces in it. Example "Storage Files" echo Formats Folder_Name // Folder_Name\ // \Folder_Name echo Folders May Follow Folders, must use a \ between folders. echo Can have a \ at the begining and end of each folder GOTO EFLOP :FIHE echo OPTIONAL echo No Spaces echo Must use ' any ' [without ''] for Extension place for all files while wanting to use a custom temp folder echo Defaults to wildstar for all files if not given a extension echo Formats txt // .txt echo no character limit on extensions :SERR echo Do NOT use regex in file extension echo leave Extension blank for wildstar GOTO ELOP :CFH echo OPTIONAL echo Will not use sub folder that currently exists echo Is a sub folder. Not setup to transfer drives. echo Use of " " is required around the entire Folder_Path input has spaces in it. Example "Temporary Files" echo Formats Folder_Name // Folder_Name\ // \Folder_Name echo Folders May Follow Folders, must use a \ between folders. echo Can have a \ at the begining and end of each folder GOTO ELOP :CFEE echo Temporary Folder Name exists already. Ensure %tmp% folder is not in the same folder as the files, or that you enter a Folder name that does not exist. echo %fpc%%fnc% pause GOTO ELOP :ELOP