Advertisement
DePhoegon

Balance shifting

Dec 2nd, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.70 KB | None | 0 0
  1. @echo off
  2. set tmp=T3mp0r4ry
  3. ::Argument 1 Prep
  4. IF %1.==. GOTO REQU
  5. IF %1==help GOTO HLPO
  6. IF %1==drive GOTO DHE
  7. IF %1==path GOTO FHE
  8. IF %1==file GOTO FIHE
  9. IF %1==temp GOTO CFH
  10. set dr=%1
  11. set dr=%dr:~0,1%
  12. IF %dr% LEQ 9 ( echo Letters Only for Drive Selection && GOTO ELOP )
  13.  
  14. ::Argument 2 Prep
  15. IF %2.==. GOTO REQU
  16. set pth=%2
  17. ::Argument 2 Space, \, / Character cleanup, avoid formatng errors
  18. :A21
  19. IF %pth%.==. GOTO REQU
  20. IF %pth:~0,1%==/ (set pth=%pth:~1%&& GOTO A21 )
  21. IF %pth:~-1%==/ (set pth=%pth:~0,-1%&& GOTO A21 )
  22. IF %pth:~0,1%==\ (set pth=%pth:~1%&& GOTO A21 )
  23. IF %pth:~-1%==\ (set pth=%pth:~0,-1%&& GOTO A21 )
  24. IF "%pth:~0,1%" == " " (set pth=%pth:~1%&& GOTO A21 )
  25. IF "%pth:~-1%" == " " (set pth=%pth:~0,-1%&& GOTO A21 )
  26.  
  27. ::Argument 3 Prep
  28. IF %3.==. GOTO THIR
  29. set ex=%3
  30. ::Cleanup of multiple periods
  31. :A31
  32. IF %ex:~0,1%==. (set ex=%ex:~1%&& GOTO A31 )
  33. IF %ex:~0,1%==* GOTO SERR
  34. GOTO SFR
  35. :THIR
  36. set ex=*
  37. :SFR
  38.  
  39. :: Argument 4 Cleanup
  40. set csf=%4
  41. IF %4.==. set csf=%tmp%
  42. ::Argument 4 Space, \, / Character cleanup, avoid formatng errors
  43. :A41
  44. IF %csf:~0,1%==/ (set csf=%csf:~1%&& GOTO A41 )
  45. IF %csf:~-1%==/ (set csf=%csf:~0,-1%&& GOTO A41 )
  46. IF %csf:~0,1%==\ (set csf=%csf:~1%&& GOTO A41 )
  47. IF %csf:~-1%==\ (set csf=%csf:~0,-1%&& GOTO A41 )
  48. IF "%csf:~0,1%" == " " (set csf=%csf:~1%&& GOTO A41 )
  49. IF "%csf:~-1%" == " " (set csf=%csf:~0,-1%&& GOTO A41 )
  50.  
  51. set w2=%dr%:\%pth%\
  52. set w2t=%w2%%csf%\
  53.  
  54. IF NOT EXIST %w2% GOTO REQU
  55. IF EXIST "%w2t%" GOTO CFEE
  56. mkdir "w2t%"
  57. for %%i in (%w2%*.%ex%) do (
  58. copy "%%i" %w2t%
  59. del /f "%%i"
  60. )
  61. move "%w2t%%fi%" %w2%
  62. rmdir "%w2t%"
  63. GOTO ELOP
  64. :REQU
  65. echo "Requires Valid Paramaters to be passed into the file as well."
  66. echo Use ' BalShift help ' to get more info. LOWERCASE
  67. echo (BalShift Drive_Letter* // Folder_Path* // File_Extenstion // Custom_TempFolder)
  68. echo XYZ* is mandatory
  69. GOTO ELOP
  70. :HLPO
  71. echo Help for batch commands
  72. echo Paramater Order (Drive_Letter* // Folder_Path* // File_Extenstion // Custom_TempFolder)
  73. echo Default Hold folder for the 'Balancing' is %tmp%
  74. echo ' BalShift drive ' for Valid Drive leters
  75. echo ' BalShift path ' for Folder Path Formating
  76. echo ' BalShift file ' for Valid inputs
  77. echo ' BalShift temp ' for Valid Temp folders
  78. GOTO ELOP
  79. :DHE
  80. echo REQUIRED
  81. echo Any Drive letter A-Z
  82. echo Formats C // C: // C:/
  83. echo No Spaces
  84. GOTO ELOP
  85. :FHE
  86. echo REQUIRED
  87. echo Spaces are allowed within the folder name, not before or after
  88. echo Use of " " is required around the entire Folder_Path input has spaces in it. Example  "Storage Files"
  89. echo Formats Folder_Name // Folder_Name\ // \Folder_Name
  90. echo Folders May Follow Folders, must use a \ between folders.
  91. echo Can have a \ at the begining and end of each folder
  92. GOTO EFLOP
  93. :FIHE
  94. echo OPTIONAL
  95. echo No Spaces
  96. echo Must use "" for Extension place for all files while wanting to use a custom temp folder
  97. echo Defaults to wildstar for all files if not given a extension
  98. echo Formats  txt //  .txt
  99. echo no character limit on extensions
  100. :SERR
  101. echo leave Extension blank for wildstar
  102. GOTO ELOP
  103. :CFH
  104. echo OPTIONAL
  105. echo Will not use sub folder that currently exists
  106. echo Is a sub folder.  Not setup to transfer drives.
  107. echo Use of " " is required around the entire Folder_Path input has spaces in it. Example  "Temporary Files"
  108. echo Can have a \ at the begining and end of each folder
  109. echo Formats Folder_Name // Folder_Name\ // \Folder_Name
  110. echo Following Not Suggested, but allowed.
  111. echo Folders May Follow Folders, must use a \ between folders.
  112. echo [Will only remove last Child folder created for Temporary holds]
  113. GOTO ELOP
  114. :CFEE
  115. 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.
  116. :ELOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement