Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Υ υ.flow
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • J-Loop
  • υ.flow
  • Wiki
  • ✅ migrate caches.bat

Last edited by Alice Jbaas Sep 21, 2025
Page history
This is an old version of this page. You can view the most recent version or browse the history.

✅ migrate caches.bat

You're absolutely right — and you're in control now. Let's reset the noise and give you one clean, perfectly formatted, ready-to-run script.


✅ migrate-caches.bat — Final Clean Version

📌 Run as Administrator
🔁 Safely moves AI & dev caches off C:
✅ Preserves data, verifies copy, optional symlinks
💾 Reclaim 10–50+ GB of space

@echo off
:: =====================================================
:: 🔧 MIGRATE DEV CACHES TO EXTERNAL DRIVE
:: Safely moves Hugging Face, pip, npm to E:\dev-cache
:: Preserves data, verifies copy, optional symlinks
:: Run as Administrator
:: =====================================================

setlocal enabledelayedexpansion

:: === CONFIG: Change E: to your large drive ===
set EXTERNAL_DRIVE=E:
set BASE_DIR=%EXTERNAL_DRIVE%\dev-cache

:: Cache locations
set HF_SOURCE=%USERPROFILE%\.cache\huggingface
set HF_TARGET=%BASE_DIR%\huggingface
set PIP_SOURCE=%LOCALAPPDATA%\pip\cache
set PIP_TARGET=%BASE_DIR%\pip
set NPM_SOURCE=%APPDATA%\npm-cache
set NPM_TARGET=%BASE_DIR%\npm
set TORCH_TARGET=%BASE_DIR%\torch

:: Create base directory
if not exist "%BASE_DIR%" mkdir "%BASE_DIR%"

echo.
echo 🎯 Target: %BASE_DIR%
echo    Existing files will be preserved.
echo    Press any key to continue... & pause >nul
echo.

:: =============================
:: 🔁 MIGRATE: Hugging Face
:: =============================
call :migrate_dir "%HF_SOURCE%" "%HF_TARGET%" "Hugging Face"

:: =============================
:: 🔁 MIGRATE: pip
:: =============================
call :migrate_dir "%PIP_SOURCE%" "%PIP_TARGET%" "pip"

:: =============================
:: 🔁 MIGRATE: npm
:: =============================
call :migrate_dir "%NPM_SOURCE%" "%NPM_TARGET%" "npm"

:: =============================
:: 🔁 MIGRATE: Torch (no source, just redirect)
:: =============================
if not exist "%TORCH_TARGET%" mkdir "%TORCH_TARGET%"
echo ✅ Torch cache will use: %TORCH_TARGET%

:: =============================
:: 🔗 OPTIONAL: Create Symlinks
:: =============================
echo.
echo 🔗 Create symbolic links to redirect C:\ caches to %EXTERNAL_DRIVE%?
echo    This reclaims space and keeps tools working.
echo    WARNING: Requires Admin rights.
echo.
choice /c YN /m "Create symlinks? (Y/N)"
if %errorlevel% == 2 goto no_symlinks

:: Remove old dirs and link new ones
if exist "%HF_SOURCE%" rd /s /q "%HF_SOURCE%"
if not exist "%HF_SOURCE%" mklink /J "%HF_SOURCE%" "%HF_TARGET%" && echo 🔄 Linked: Hugging Face

if exist "%PIP_SOURCE%" rd /s /q "%PIP_SOURCE%"
if not exist "%PIP_SOURCE%" mklink /J "%PIP_SOURCE%" "%PIP_TARGET%" && echo 🔄 Linked: pip

if exist "%NPM_SOURCE%" rd /s /q "%NPM_SOURCE%"
if not exist "%NPM_SOURCE%" mklink /J "%NPM_SOURCE%" "%NPM_TARGET%" && echo 🔄 Linked: npm

echo.
echo 🎉 Done! Tools now use %EXTERNAL_DRIVE%. C:\ caches are links.
goto end

:no_symlinks
echo.
echo 💡 No symlinks created. Add these to your .cmd scripts:
echo.
echo    set HF_HOME=%HF_TARGET%
echo    set PIP_CACHE_DIR=%PIP_TARGET%
echo    set TORCH_HOME=%TORCH_TARGET%
echo    set TMP=%BASE_DIR%\tmp
echo    set TEMP=%BASE_DIR%\tmp
echo.
echo    Then run your worker as usual.

:end
echo.
echo ✅ Migration complete. You’ve just reclaimed C:!
echo    Check %BASE_DIR% — your AI caches are now safe and sound.
pause
exit /b

:: ============
:: FUNCTION: Migrate and verify a directory
:: ============
:migrate_dir
set SOURCE=%~1
set TARGET=%~2
set NAME=%~3

echo 🚚 Migrating %NAME% cache...
echo    From: %SOURCE%
echo    To:   %TARGET%

:: Source doesn't exist? Create target and skip
if not exist "%SOURCE%" (
    if not exist "%TARGET%" mkdir "%TARGET%"
    echo ⚠️  No %NAME% cache found at source. Target created.
    echo.
    exit /b
)

:: Target already exists? Skip copy
if exist "%TARGET%" (
    echo 💡 Found existing cache at %TARGET%. Skipping copy.
    echo   
Clone repository
  • Yntended Journey
  • Yntended Journey
    • TEE(9) the Ridge Aware
    • TEE(9) the Ridge Aware
      • 🌬️:9: The wind
  • checkpoint.g.l.i.d.e 000
  • checkpoint.x.bj.o 001
  • checkpoint.x.bj.o 002
  • checkpoint.x.bj.o 003
  • checkpoint.x.bj.o 004
  • checkpoint.x.bj.o 005
  • checkpoint.x.bj.o 006
  • checkpoint.x.bj.o 007
  • checkpoint.x.bj.o 008
  • checkpoint.x.bj.o 009
  • checkpoint.x.bj.ox 000
  • checkpoint.x.bj.ox 001
View All Pages