Advertisement
flikamasha

xaero cleanup

Oct 16th, 2024
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.76 KB | None | 0 0
  1. @echo off
  2.  
  3. :: Get the current directory (where the script is running from)
  4. set "currentDir=%~dp0"
  5.  
  6. :: ------------------------
  7. :: XaeroWaypoints Directory
  8. :: ------------------------
  9.  
  10. :: Set the target directory for XaeroWaypoints
  11. set "waypointsDir=%currentDir%XaeroWaypoints\Folder_name_here"
  12.  
  13. :: Change directory to the XaeroWaypoints target directory
  14. cd /d "%waypointsDir%"
  15.  
  16. :: Find the most recent folder matching the pattern "dim%the_vault$vault_"
  17. set "mostRecentWaypointFolder="
  18. for /f "delims=" %%f in ('dir /ad /b /o-d dim%%the_vault$vault_*') do (
  19.     if not defined mostRecentWaypointFolder set "mostRecentWaypointFolder=%%f"
  20. )
  21.  
  22. :: Loop through and delete folders that match the pattern "dim%the_vault$vault_" except the most recent one
  23. for /d %%f in (dim%%the_vault$vault_*) do (
  24.     if "%%f" neq "%mostRecentWaypointFolder%" (
  25.         echo Deleting folder in XaeroWaypoints: %%f
  26.         rd /s /q "%%f"
  27.     )
  28. )
  29.  
  30. :: ------------------------
  31. :: XaeroWorldMap Directory
  32. :: ------------------------
  33.  
  34. :: Set the target directory for XaeroWorldMap
  35. set "worldMapDir=%currentDir%XaeroWorldMap\Folder_name_here"
  36.  
  37. :: Change directory to the XaeroWorldMap target directory
  38. cd /d "%worldMapDir%"
  39.  
  40. :: Find the most recent folder matching the pattern "the_vault$vault_"
  41. set "mostRecentWorldMapFolder="
  42. for /f "delims=" %%f in ('dir /ad /b /o-d the_vault$vault_*') do (
  43.     if not defined mostRecentWorldMapFolder set "mostRecentWorldMapFolder=%%f"
  44. )
  45.  
  46. :: Loop through and delete folders that match the pattern "the_vault$vault_" except the most recent one
  47. for /d %%f in (the_vault$vault_*) do (
  48.     if "%%f" neq "%mostRecentWorldMapFolder%" (
  49.         echo Deleting folder in XaeroWorldMap: %%f
  50.         rd /s /q "%%f"
  51.     )
  52. )
  53.  
  54. :: Exit the script
  55. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement