Created
June 9, 2020 03:46
-
-
Save blueal/4af76a54edb2e6eee57c89d2654280ca to your computer and use it in GitHub Desktop.
Program prompts for directory path, and continusously prompts for new folder names for each file found in the directory. It will than move each file into it's own directory and optionally prompt for renaming the file as well. This program is designed for manual human input. Useful for moving a large collection of Plex Movie files into there own …
This file contains 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 No Direct Inputs, Program will ask for Manual Input | |
REM Purpose: Take a directory of files, Place file within it's own folder prompting for folder name, | |
REM and give an opportunity to rename the file. | |
REM Workflow: | |
REM Program always asuumes you are moving files into folders, it will always prompt for input but | |
REM always opportunity to skip | |
REM Always asks if you want to rename the file as well. Just in case there's a mistake. If no, it will only | |
REM move the file without renaming it. | |
REM Usecase: | |
REM I use this to move lot's of individual movie files into folders. Plex requires a folder structure | |
REM and this work wonderfully for that. | |
ECHO Starting MoveFilesIntoFolder: | |
ECHO. | |
ECHO. | |
ECHO DANGER DANGER DANGER: All inputs, including directory path, must be entered in exactly correctly! | |
ECHO Failure to do so may result in data loss and unexpected behavior! | |
ECHO Press Ctrl+c to cancel program at any time. | |
ECHO. | |
ECHO. | |
SETLOCAL EnableDelayedExpansion | |
:START | |
SET /p "filepath=Please Enter Fully Qualified Directory Path:" | |
if exist "%filepath%" ( | |
echo Directory Found: "%filepath%" | |
echo Are you sure you want to proceed? | |
pause | |
) ELSE ( | |
echo ERROR: "%filepath% does not exist. Try again. | |
pause | |
echo HINT: Copying the file path directory from Windows Explorer usually works well. | |
GOTO START | |
) | |
cd /D "%filepath%" | |
for %%f in (*) do ( | |
echo "%filepath%\%%f" | |
set /p "input=New Directory Name? Press s to skip: " | |
if NOT "!input!" == "s" ( | |
echo "%%f" | |
SET /p "rename=Should I rename this file as well? (y/n)" | |
if "!rename!" == "y" ( | |
set /p "newname=What Should I rename it to? :" | |
RENAME "!filepath!\%%f" "!newname!" | |
mkdir "!filepath!\!input!" | |
move "!filepath!\!newname!" "!filepath!\!input!" | |
) else ( | |
mkdir "!filepath!\!input!" | |
move "!filepath!\%%f" "!filepath!\!input!" | |
) | |
) else ( | |
echo Skip! | |
) | |
echo. | |
) | |
ENDLOCAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment