Advertisement
Guest User

archiveAndUploadLTLogsToFTP

a guest
Aug 29th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.55 KB | None | 0 0
  1. @ECHO OFF
  2. REM *** Paths and Prefixes
  3. REM *** Paths and Prefixes
  4. REM *** Paths and Prefixes
  5. set sourcePath=C:\Program Files\Labtech\Logs set destPath=%WINDIR%\Temp set destFilePrefix=LTLogsForAcronis_ REM *** FTP Settings REM *** FTP Settings REM *** FTP Settings set uploadToFTP=YES set ftpServer=cftp.acronis.com set ftpUser=<insert ftp user name here> set ftpPass=<insert ftp user pass here> set ftpPath=Log Snapshots/ REM *** code below this line REM *** code below this line REM *** code below this line set hh=%time:~-11,2% set /a hh=%hh%+100 set hh=%hh:~1% set stampDateTime=%date:~10,4%%date:~4,2%%date:~7,2%T%hh%%time:~3,2%%time:~6,2%
  6. set destFilename=%destFilePrefix%%stampDateTime%.zip
  7. IF EXIST "%destPath%\%destFilename%" EXIT /B 1 powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem';[IO.Compression.ZipFile]::CreateFromDirectory('%sourcePath%', '%destPath%\%destFilename%'); }"
  8. IF NOT EXIST "%destPath%\%destFilename%" EXIT /B 1 IF NOT DEFINED uploadToFTP EXIT /B DEL /Q "%destPath%\curl.*"
  9. powershell.exe -nologo -noprofile -command "& { (New-Object Net.WebClient).DownloadFile('http://www.paehl.com/open_source/?download=curl_761_0.zip','%destPath%\curl.zip');(new-object -com shell.application).namespace('%destPath%').CopyHere((new-object -com shell.application).namespace('%destPath%\curl.zip').Items(),16); }"
  10. IF NOT EXIST "%destPath%\curl.exe" EXIT /B 1 "%destPath%\curl.exe" -T "%destPath%\%destFilename%" "ftp://%ftpServer%/%ftpPath%%stampDateTime%.zip" --user %ftpUser%:%ftpPass% DEL /Q "%destPath%\curl.*"
  11. EXIT /B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement