Professional Documents
Culture Documents
echo. echo Press a key to exit. pause >nul This batch is used to call the 7z-batch and copy the compressed folder to the mounted USB flash drive and to a logical drive of your local pc. Make sure that you adjust the path name of the batch, so that it fits. It then calls a second batch. The if-stricture is used here as well, but thats not necessary, Its just to check if the compressed file is at the right, specified location. Next, lets move on to the ftp batch. For the ftp upload the integrated ftp.exe client of windows found in windows/system32 can be used. Create a file called ftp.ftp, open it with your editor and just put the following simple commands in it to make the upload work. OPEN "IP-address" port USER "username" "password" BINARY PUT "C:\Documents-Backup-Upload.7z" BYE * Write the IP-Address, the username and the password without quotes. Dont forget to put the right port number after the ip-address. So it looks something like: 192.168.0.55 21 (21 is the port number here). This is what the file could look like. Only a few commands are used to upload one file. BINARY means that you are uploading an executable file, which is the case here. Its an compressed archive. You can also put text files using the ASCII command. PUT is obviously used to put a file on a ftp server, GET can be used to download a file. BYE disconnects the user from the server. Now you need another batch file (ftpbatch.bat here) that starts that ftp-upload-file (ftp.ftp). ftp -n -i -s:G:\ftp.ftp The last batch file is called 2ndcopybatch.bat here: @echo off REM second copy batch CALL "G:\ftpbatch.bat" This file just calls the ftpbatch.bat, nothing else.
If you put it all together correctly, it should work. And as mentioned before this can all be done using only two or three batches. Its a very easy way to make multiple backups work by using batchfiles. Perfect for documents and something small. Its best to keep all the batchfiles in one folder.