Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: static path and variable name of zip file when backup a directory

wasimxe wrote:

Sorry I can't post new topic, so I am asking question here. Please see screenshot https://prnt.sc/g8a2ig
currently I am trying this command

zip -r "!?&Enter an Archive Name:?/home1/tanxe/backup/archive.zip!" !&

but I want to replace "archive" with directory name I want to zip.

It's not possible to default the prompt value to the name of selected file, if that's what you ask for.
Though with a shell construct, you can force the default, if you leave the prompt empty.
wasimxe

static path and variable name of zip file when backup a directory

Sorry I can't post new topic, so I am asking question here. Please see screenshot https://prnt.sc/g8a2ig
currently I am trying this command

zip -r "!?&Enter an Archive Name:?/home1/tanxe/backup/archive.zip!" !&

but I want to replace "archive" with directory name I want to zip.
Evan Boyd

Re: Compress a directory before put command.

martin wrote:

Just use any command-line utility from the batch-file to archive the C:\steamcmd\rust\backup\0\TheRustySpittoon_Live\ before running the WinSCP. Then use WinSCP to upload the archive. This has nothing to do with WinSCP.


Okay so I've been at this forever and I finally figured it out! I was able to call 7-zip, compress the folder I wanted, generate a temp script on the fly to upload to FTP and it even cleans everything up after.

I'm posting this just in-case anyone in the future needs to do what I needed to.

run.bat
set FileDate=%date:~10,4%_%date:~4,2%_%date:~7,2%

set BackupFile=C:\winscp\Backup_%FileDate%.7z

"C:\Program Files\7-Zip\7z.exe" a -r %BackupFile% C:\steamcmd\rust\server\TheRustySpittoon_Live

rem Generate temporary script to upload %BackupFile%
echo option batch on > script.tmp
echo option confirm off >> script.tmp
echo open backups >> script.tmp
echo put %BackupFile% "/TheRustySpittoon_Live/" >> script.tmp
echo exit >> script.tmp

rem Execute script
"C:\winscp\winscp.com" /script=script.tmp

rem Delete temporary script
del script.tmp
del Backup_%FileDate%.7z
Evan Boyd

What has nothing to do with WinSCP, the zipping a folder? Just to make sure I understand you correctly, you suggest having the bat file itself zip the directory, and not the WinSCP script?

What I'm trying to achieve is

Zip the directory

Upload that zip to my ftp

Delete local zip

Exit

This cannot be done with WinSCP?

Sorry, I'm just trying to fully understand...
martin

Re: Compress a directory before put command.

Just use any command-line utility from the batch-file to archive the C:\steamcmd\rust\backup\0\TheRustySpittoon_Live\ before running the WinSCP. Then use WinSCP to upload the archive. This has nothing to do with WinSCP.
Evan Boyd

Compress a directory before put command.

Hello,

I'm rather new to all of this but I was finally able to get my game server to auto backup with windows scheduled tasks and WinSCP however, the transfer takes longer than I'd like because of all of the individual files in the directory i'm backing up each night. Is there a way I can compress this prior to it being uploaded to my FTP?

Here is my current Script/Bat

Script
option batch abort

option confirm off
open backups
put "C:\steamcmd\rust\backup\0\TheRustySpittoon_Live\" "/TheRustySpittoon_Live/Backup-%STAMP%"
exit


Bat
@echo off

 
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set LDT=%%j
set STAMP=%LDT:~0,4%-%LDT:~4,2%-%LDT:~6,2% %LDT:~8,2%-%LDT:~10,2%-%LDT:~12,2%
 
winscp.com /script=backup_script.txt


I literally have tried everything, I can't get it to even begin to zip a folder the console just instantly closes, with nothing. Any help would be greatly appreciated.

In advanced, thanks