Recommended Posts

Simple little backup script which will backup some files using winrar and upload them to a ftp server automatically.

Some requirements

1.Install WinRAR (www.winrar.com)

2.Remote FTP Server

?

Load up notepad and type the following:

@ECHO OFF
?
echo Please Wait...Backup in progress.
?
>backup_list.script ECHO D:\
>>backup_list.script ECHO E:\Important

?

?

The important parts are >backup_list.script ECHO D:\ and the line below. These lines will tell winrar which files to backup.

?

>backup_list.script ECHO D:\ - Anything after the ECHO is printed to a file called ‘backup_list.script’. In this case D:\ (where my documents are). It is important for the first line to have a single ‘>’. This creates a new file. Add as many ‘>>’ lines as you want with all the paths you wish to backup.

?

Next the exclusion lists. Winrar will backup ALL files with in the directories listed above, this is not always practical. Add any exclusions using the following commands:

?

>backup_x_list.script ECHO D:\Do Not Backup Folder
>>backup_x_list.script ECHO D:\Borland Studio Projects
>>backup_x_list.script ECHO D:\System Volume Information
>>backup_x_list.script ECHO D:\My PSP Files
?
>>backup_x_list.script ECHO D:\desktop.ini
>>backup_x_list.script ECHO D:\Default.rdp

?

Remember the first line must have a single ‘>’. If adding a directory do not include a final slash. For files include the full path.

?

Next the important part:

?
"C:\Program Files\WinRAR\RAR.exe" a -hppassword -m5 -r E:\ \backup.rar @backup_list.script -t -x@backup_x_list.script
?

This tells winrar to execute and create a new archive including and excluding the files listed above. The archived will be called ‘backup.rar’. The command ‘-hppassword’ adds a password to the archive for security, change password to something else eg. ‘-hpnewpassword’.

?

Now upload the files to the web.

?

echo Please Wait...Uploading Files.
>script.ftp ECHO username
>>script.ftp ECHO password
>>script.ftp ECHO cd backup_folder/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit

?

Change username and password to the correct values. Change ‘CD backup_folder/’ to where ever you wish the file to be saved remotely. Remember to include the final slash.

?

?

Next to connect the ftp site and run the script:

?
FTP -v -s:script.ftp ftp.ftpsite.net
?

Change ftp.ftpsite.net to your site.

?

Delete the scripts:

?

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script
?

?All done.

Set up Scheduling using the built in Windows Scheduled Tasks application.

Start->Settings->Control Panel->Scheduled Tasks->Add Scheduled Task

and follow the wizard. I have mine to run every sunday night.

My complete script:

@ECHO OFF


echo Please Wait...Backing Up Files.
>backup_list.script ECHO D:\

>backup_x_list.script ECHO D:\Borland Studio Projects
>>backup_x_list.script ECHO D:\Installed
>>backup_x_list.script ECHO D:\Documents
>>backup_x_list.script ECHO D:\System Volume Information
>>backup_x_list.script ECHO D:\My PSP Files
>>backup_x_list.script ECHO D:\desktop.ini
>>backup_x_list.script ECHO D:\Default.rdp

"C:\Program Files\WinRAR\RAR.exe" a -hpMYPASSWORD -m5 -r backup.rar @backup_list.script -t -x@backup_x_list.script

echo Please Wait...Uploading Files.
>script.ftp ECHO USERNAME
>>script.ftp ECHO PASSWORD
>>script.ftp ECHO cd backup/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit


FTP -v -s:script.ftp ftp.MYFTPSITE.net

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script


Echo Done.....

I hope some people find this useful.

Edited by B3AN
Link to comment
https://www.neowin.net/forum/topic/325654-guide-automated-backup/
Share on other sites

Some files you may wish to backup.

Opera

Take a look at : Site

Firefox

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\bookmarks.html

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cert8.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cookies.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\prefs.js

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\signons.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\key3.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\extensions\

  B3AN said:
Some files you may wish to backup.

Opera

Take a look at : Site

Firefox

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\bookmarks.html

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cert8.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\cookies.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\prefs.js

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\signons.txt

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\key3.db

%Appdata%\Mozilla\Firefox\Profiles\*YOUR PROFILE NAME*\extensions\

585984940[/snapback]

cheers for that too. almost forgot my bookmarks!

(i know this is triple post, sorry).

I need some help.

This is what i have:

@ECHO OFF

echo Please Wait...Backup in progress.

>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\bookmarks.html
>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\signons.txt
>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\prefs.js
>>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\cookies.txt

"D:\Program Files\WinRAR\RAR.exe" a -hpeggs -m5 -r backup.rar @backup_list.script -t -x@backup_x_list.script

echo Please Wait...Uploading Files.
>script.ftp ECHO bhav
>>script.ftp ECHO ******
>>script.ftp ECHO backup/
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put backup.rar
>>script.ftp ECHO quit

FTP -v -s:script.ftp ftp.******.com

DEL script.ftp
DEL backup_x_list.script
DEL backup_list.script

Echo Done.....

but when i run the .bat, the command prompt window flashes (disappears very quickly), and i just get a file created in the same directory as the .bat called backup_list.script, which only says the following:

C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\bookmarks.html
C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\signons.txt

Any idea what's wrong?

(NB: winrar is installed on the D drive on my pc)

  Bhav said:
>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\prefs.js

>>>>backup_list.script ECHO C:\Documents and Settings\Shah\Application Data\Mozilla\Firefox\Profiles\0wnof4re.default\cookies.txt

...

Any idea what's wrong?

586004857[/snapback]

Only use >> for those lines, not >>> or >>>>.

  hurting101 said:
Only use >> for those lines, not >>> or >>>>.

586004995[/snapback]

oh right i see.

ok so the script has got a bit further this time.

but now there's an error in command prompt.

it says:

  Quote
Cannot open backup_x_list.script

The system cannot find the file specified

then it tries to upload, but there's nothing to upload.

edit: nevermind all sorted, just removed the bit about backup_x_list.script in the script.

thanks for this script, and cheers for the help hurting101.

Edited by Bhav
  cpu121 said:
I agree, is it possible for you to show us how to modify the script to back up to a another disk/partition/machine on the local network?

586069186[/snapback]

Well instead of the ftp section you could use the copy command for example:

Network Drive:

copy backupfile.rar \\network\share\backupfile.rar

Normal Folder:

copy backupfile.rar e:\Backups\backupfile.rar

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I am low-key enjoying the new start menu of 25H2 build. Looks like the management team who shoved the Recommended Section down our throats up till now got fired in recent gommage at MS. Also loving the 6Ghz Hotspot feature. I only enabled these 2 features and I am happy. I keep an eye on MDL forums for 26200.xxxx updates once a week to stay up to date manually. I downloaded the latest build from https://uupdump.net selected Dev Channel tab and downloaded amd64 build. Let the script ripp. Then I used vivetool to enable the above 2 features • 25H2 New Start Menu ViVeTool.exe /enable /id:47205210,49221331,49381526,49402389,49820095,55495322,48433719 • Enable Wifi 6Ghz Hotspot ViVeTool.exe /enable /id:40466470,48433719 Reboot and enjoy. Almost all the above info was provided by Neowin at some point.
    • Indeed, I do think its sad in some ways a corporation can never be content with "performing well across every metric" and having over £59 billion cash on hand.
    • They've been focusing on security and quality? Could have fooled me. Their own paying customers literally just got breached because they failed to push SharePoint updates downstream to on prem servers operating outside of their "365" ecosystem.
    • The animosity is unnecessary, when I opened the page I only saw one response which never mentioned your other steps, and when I hit reply it jumped straight to the bottom and again, I saw no other responses.  I was simply agreeing with the first comment that said yes, you should be fine if you erase its current operating system. Using another PC, or the copy of Windows that comes on that PC (former option is more trustworthy), download and run the Windows Media Creation tool.  It will walk you thru the process of downloading Windows and writing it to a USB stick.  It will even ask you at one point whether you're reinstalling it to the current machine or installing it on another machine. Then just boot the PC in question from that USB stick.  Usually spamming Esc, Del, F-8, F-9, F-10, F-11, F-12 or F-2 immediately after power on will bring up a boot menu, it varies by manufacturer.  If Windows starts booting you either missed your window or hit the wrong key. Follow the on-screen instructions.  When it gets to the disk formatting part I usually just delete all the partitions on the destination drive, then select the unpartitioned space as my destination.  The Windows installer will then automatically partition the drive as needed. Be prepared to download drivers from the PC manufacturer's website, they may not come bundled with Windows and you may not be able to use things like WiFi or ethernet until you have them.  They "might" work straight away, but they also might not.  Better to be prepared with a spare PC and a USB stick to transfer them over.
    • Wise Disk Cleaner 11.2.5 by Razvan Serea Wise Disk Cleaner is a free disk utility designed to help you keep your disk clean by deleting any unnecessary files. Usually, these unnecessary, or junk files appear as a result of program's incomplete uninstalls, or Temporary Internet Files. It is best if these files are wiped out from time to time, since they may, at some point, use a considerable amount of space on your drives. Wise Disk Cleaner, with its intuitive and easy to use interface, helps you quickly wipe out all the junk files. Using the program is indeed easy. It also works fast when both scanning for files and deleting files. The new Wise Disk Cleaner has more advantages: improved performance, better interface and scans/cleans more thoroughly. Wise Disk Cleaner Free provides lifetime free update service and Unlimited Free technical support. The first Slimming System software Wise Disk Cleaner is the first system slimming tool, which will help you to remove Windows useless files that you don't need, such as Korean IME, Windows Sample music, videos, pictures, Installers and Uninstallers of Updates Patches etc. Wise Disk Cleaner 11.2.5 Build 845 changelog: Added cleaning rules for Legacy Games Launcher, Letasoft Sound Booster, Macrium Reflect, MagicLine4NX, MAGIX Photostory, MakeHuman, Max Recorder, Maxprog iCash, Lexware, LG PC Suite, Lightworks, LINE, Listary, and LockHunter. Improved cleaning rules for Xunlei, PowerToys, Meitu, OneDrive, and Tencent Video. For security reasons, users can no longer delete the latest system restore point in the Restore Center. Enhanced System Slimming. Fixed minor bugs from the previous version. Download: Wise Disk Cleaner 11.2.5 | 6.9 MB (Freeware) Download: Portable Wise Disk Cleaner 11.2.5 | 7.3 MB View: Wise Disk Cleaner Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Philsl earned a badge
      One Month Later
    • One Year In
      armandointerior640 earned a badge
      One Year In
    • One Month Later
      armandointerior640 earned a badge
      One Month Later
    • One Month Later
      Itbob513626 earned a badge
      One Month Later
    • Week One Done
      Itbob513626 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      615
    2. 2
      ATLien_0
      236
    3. 3
      Xenon
      156
    4. 4
      +FloatingFatMan
      122
    5. 5
      Michael Scrip
      116
  • Tell a friend

    Love Neowin? Tell a friend!