-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.bat
More file actions
49 lines (39 loc) · 1.14 KB
/
upload.bat
File metadata and controls
49 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@echo off
echo ============================================
echo Uploading to Host via WinSCP...
echo ============================================
echo.
REM --- CONFIGURATION ---
set SESSION_NAME=YourSessionName
set REMOTE_PATH=/_public_html/
REM ---------------------
REM Change to the folder where this .bat file is located
cd /d "%~dp0"
REM Get the FULL absolute path to _site folder (use forward slashes for WinSCP)
set SITEPATH=%CD%\_site
set SITEPATH=%SITEPATH:\=/%
echo Current Directory: %CD%
echo Site Path: %SITEPATH%
echo.
REM Check if _site folder exists
if not exist "%CD%\_site" (
echo [ERROR] _site folder not found!
echo Please run build.bat first.
pause
exit /b 1
)
echo _site folder found! Starting upload...
echo.
REM Run WinSCP with forward-slash path (no quotes around path)
"C:\Users\%USERNAME%\AppData\Local\Programs\WinSCP\WinSCP.com" /command "open %SESSION_NAME%" "synchronize remote -delete %SITEPATH% %REMOTE_PATH%" "exit"
echo.
echo Exit Code: %errorlevel%
if %errorlevel% equ 0 (
echo.
echo [SUCCESS] Upload complete!
) else (
echo.
echo [ERROR] Upload failed! See messages above.
)
echo.
pause