DePhoegon icon

Balance shifting

DePhoegon | PRO | 12/02/18 06:15:23 AM UTC | 0 ⭐ | 671 👁️ | Never ⏰ | []
Batch |

3.7 KB

|

None

|

0 👍

/

0 👎

@echo off
set tmp=T3mp0r4ry
::Argument 1 Prep
IF %1.==. GOTO REQU
IF %1==help GOTO HLPO
IF %1==drive GOTO DHE
IF %1==path GOTO FHE
IF %1==file 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 )
 
::Argument 2 Prep
IF %2.==. GOTO REQU
set pth=%2
::Argument 2 Space, \, / Character cleanup, avoid formatng errors
: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 )
 
::Argument 3 Prep
IF %3.==. GOTO THIR
set ex=%3
::Cleanup of multiple periods
:A31
IF %ex:~0,1%==. (set ex=%ex:~1%&& GOTO A31 )
IF %ex:~0,1%==* GOTO SERR
GOTO SFR
:THIR
set ex=*
:SFR
 
:: Argument 4 Cleanup
set csf=%4
IF %4.==. set csf=%tmp%
::Argument 4 Space, \, / Character cleanup, avoid formatng errors
: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 )
 
set w2=%dr%:\%pth%\
set w2t=%w2%%csf%\
 
IF NOT EXIST %w2% GOTO REQU
IF EXIST "%w2t%" GOTO CFEE
mkdir "w2t%"
for %%i in (%w2%*.%ex%) do (
copy "%%i" %w2t% 
del /f "%%i"
)
move "%w2t%%fi%" %w2%
rmdir "%w2t%"
GOTO ELOP
:REQU
echo "Requires Valid Paramaters to be passed into the file as well."
echo Use ' BalShift help ' to get more info. LOWERCASE
echo (BalShift Drive_Letter* // Folder_Path* // File_Extenstion // Custom_TempFolder)
echo XYZ* is mandatory
GOTO ELOP
:HLPO
echo Help for batch commands
echo Paramater Order (Drive_Letter* // Folder_Path* // File_Extenstion // Custom_TempFolder)
echo Default Hold folder for the 'Balancing' is %tmp%
echo ' BalShift drive ' for Valid Drive leters
echo ' BalShift path ' for Folder Path Formating
echo ' BalShift file ' for Valid inputs
echo ' BalShift 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 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 "" 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 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 Can have a \ at the begining and end of each folder
echo Formats Folder_Name // Folder_Name\ // \Folder_Name 
echo Following Not Suggested, but allowed.
echo Folders May Follow Folders, must use a \ between folders. 
echo [Will only remove last Child folder created for Temporary holds]
GOTO ELOP
:CFEE
echo Temporary Folder 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.
:ELOP

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎