More protection for your profiles

Discuss whatever you like here! ( ...that's not spam!)

Moderators: Support Staff², Support Staff, AvantGuard, Developer

Post Reply
mbrazil
AvantGuard
AvantGuard
Posts: 1966
Joined: Tue Jul 26, 2005 10:04 pm
Windows Version: 10
Avant Version: 2015 Ultimate Build 28
Default engine: Gecko (Firefox)
IE Version: 10
Skin: Monai XP
Location: Grass Valley, CA

More protection for your profiles

Post by mbrazil » Sun Mar 03, 2013 5:33 am

Would you like to have more protection for your Avant profiles so that you can always restore everything back to the way it was when something goes wrong? The following is my approach, and it ensures that I always have a complete backup of my Avant Profiles folder that is never more than 24 hours old. When I was setting this up, I decided to also back up my email and my RoboForm settings. You can include whatever you want in the automatic backup.

1. Create a folder somewhere on your system named "Internet Data" (without the quotes) that is separate from your Avant program folder and from the current location of your Avant Profiles folder. (You can name it anything you want, but for the sake of this explanation, I'll refer to it as Internet Data.)

2. Go to Tools > Avant Browser Options > Profile, and make note of the current path to the Avant Profiles folder. Then, either browse to the new Internet Data folder or enter the path to it in the text box, and click OK. The path for mine is E:\Internet Data. Your Avant Profiles folder will now be in the new Internet Data folder instead of in the old location. The full path to my Avant Profiles folder is E:\Internet Data\Avant Profiles\.

3. Shut Avant down, and copy the entire Avant Profiles folder from the old location to the new Avant Profiles folder (over the top of the profiles just created by Avant when you changed the location of the Avant Profiles folder).

4. Restart Avant, and verify that the path shown in Tools > Avant Browser Options > Profile for the new Avant Profiles folder is correct. If necessary, modify it so that it accurately points to your new Internet Data folder.

5. Decide where you want the backup to be kept, and create a folder there called "Internet Data Backup", or use whatever name you want.

6. Create a plain text file in the Internet Data Backup folder named "parent.lock.txt". The entire contents of this file should be:
".lock" (without the quotation marks).

7. Create a Windows batch file named Internet Data Backup.bat (or whatever) that contains only the following line and save it in your Internet Data Backup folder:

xcopy "X:\Internet Data" "Y:\Internet Data Backup" /c /d /e /h /r /y /exclude:parent.lock.txt

In this case, the quotation marks belong where they are and should not be removed. Replace X: with the drive letter where you created your new Avant Profiles folder, and replace Y: with the drive letter where you created the Internet Data Backup folder. If your new Internet Data and Internet Data Backup folders are not in the root folder of the drive(s), be sure to modify the path(s) to the(se) folders in the xcopy command in the batch file so that they accurately point to the folder locations.

For explanations regarding all of the xcopy switches I've specified (/c /d /e /h /r /y /exclude:), just type xcopy /? at a command prompt.

The parent.lock.txt file and the inclusion of /exclude:parent.lock.txt in the xcopy command line are necessary if you are using Avant Ultimate, because you'll get a sharing violation when the batch file tries to copy the parent.lock file that's contained in the gecko profile, and that will terminate the batch file's operation before it finishes. If you're not using Ultimate, you should skip step 6 and leave out /exclude:parent.lock.txt when creating the batch file.

If you want to include your email data, your RoboForm data, and/or anything else related to what you do online in the backup, simply reconfigure those programs so that they store their data in a folder within the Internet Data folder (not the Internet Data Backup folder). You don't have to modify the batch file, as any folders within the Internet Data folder will be included in the backup.

The first time the batch file runs, it will take some time to complete, as there are quite a few files to copy, but after the first time, the batch file only copies files that have changed since the last backup.

To automate running the batch file so that the backup is updated every day at a certain time (or times), create a Windows Scheduled Task. In Control Panel under Scheduled Tasks, click Add Scheduled Task and browse to Internet Data Backup.bat in the Scheduled Task Wizard. Choose Daily, and set the time you want the backup to occur (mine runs at 1:00 AM). The start date should be the current date. Enter your Windows user name and password, and click Finish. If you want the backup to run more than once a day, check the box for Open advanced properties before clicking Finish. On the Schedule tab, click Advanced, check Repeat task, and set up whatever schedule you want.

Written up this way, this sounds a lot more complex and time consuming to set up than it actually is. It's not really a big deal, and once it's done and working, you shouldn't have to mess with it again. If (more likely, when) you have to restore your Avant profiles, just copy the entire Avant Profiles folder from the Internet Data Backup folder to the Internet Data folder (Avant should not be running when you do this).

Ask questions if you need clarification, etc. :D :wave:

gadi_sam
Newbie
Newbie
Posts: 23
Joined: Sun Apr 22, 2012 9:37 pm
Windows Version: XP
Avant Version: 2012 build8
IE Version: 8

Re: More protection for your profiles

Post by gadi_sam » Tue Mar 26, 2013 1:09 pm

mbrazil wrote:xcopy "X:\Internet Data" "Y:\Internet Data Backup" /c /d /e /h /r /y /exclude:parent.lock.txt
I have a question about this xcopy command which you suggested, which is not related to Avant, I hope it's OK to ask here. Suppose I want to do xcopy "X:\SomeFolder" "Y:\SomeFolder Backup"
and I want to exclude subfolder X:\SomeFolder\abc from being copied. I tried to write /exclude\abc\ in various ways (with or without the backslashes), but it keeps telling me "Can't read fie abc".
Is it possible to exclude a whole folder? And how?

mbrazil
AvantGuard
AvantGuard
Posts: 1966
Joined: Tue Jul 26, 2005 10:04 pm
Windows Version: 10
Avant Version: 2015 Ultimate Build 28
Default engine: Gecko (Firefox)
IE Version: 10
Skin: Monai XP
Location: Grass Valley, CA

Re: More protection for your profiles

Post by mbrazil » Wed Mar 27, 2013 4:21 am

gadi_sam wrote:Suppose I want to do xcopy "X:\SomeFolder" "Y:\SomeFolder Backup" and I want to exclude subfolder X:\SomeFolder\abc from being copied. I tried to write /exclude\abc\ in various ways (with or without the backslashes), but it keeps telling me "Can't read fie abc". Is it possible to exclude a whole folder? And how?
The /EXCLUDE switch is somewhat complicated and confusing to use, and the Microsoft help for it isn't much help. :wtf: :) To get some idea how the /EXCLUDE switch is used, first take another look at what I put in steps 6 and 7.

To use the /EXCLUDE switch, you have to create a text file that contains one or more character strings (each one on its own line if you need more than one) that define the files or folders you want to exclude. In step 6, you create a text file that contains the string ".lock". When the xcopy command is processed, the /EXCLUDE switch tells it to open the text file specified (in this case, parent.lock.txt) and to not copy files or folders whose names include the string in the text file (parent.lock.txt contains only .lock) when it copies the contents of the folder or folders specified in the xcopy command (in this case, X:\Internet Data\), it bypasses every file or folder whose name includes .lock.

So, to copy X:\SomeFolder\ to Y:\SomeFolder Backup\ but exclude subfolder X:\SomeFolder\abc\, you must first create a text file that contains "abc" on the first line (and nothing else). If you want to specify other files or folders to skip, put all or part of the file or folder names for those files or folders on separate lines, one string per line. When xcopy processes your command and reads the text file specified in the /EXCLUDE switch, it skips every file or folder whose name includes abc. This means that you have to be careful when deciding what strings to put in the text file, because it will exclude files or folders named 123abc, abc456, abcdef, xyzabc123, etc.

There are some other things that are important when setting this up:

* The colon (:) after /exclude must always be there.

* When you specify the text file for the /EXCLUDE switch, you can name it whatever you want to (as long as there are no spaces in the name), but if you're executing the xcopy command in a command-prompt window, the text file must be in the current path, or you must specify the entire path to the text file.

* Similarly, if you're going to put the xcopy command in a batch file, the text file must either be kept in the same folder as the batch file, or you must include the full path to the text file in the /EXCLUDE switch. For example, if you name your text file skip_abc.txt (note the underscore in the name -- the /EXCLUDE switch will not recognize path or file names with spaces in them) and put the text file in the same folder with the batch file, the /EXCLUDE portion of the xcopy command would look like this: /exclude:skip_abc.txt. If you keep the text file somewhere else, such as C:\whatever\, the /EXCLUDE portion of the xcopy command would look like this:
/exclude:C:\whatever\skip_abc.txt.

* If you just want to specify a certain folder to exclude, you can put the actual folder name in the text file instead of a string. For example, to exclude the abc folder, the text file would contain a single line and you'd put \abc\ on that line (as long as the abc folder is a subfolder of X:\SomeFolder\ -- if it's not, you need to specify the complete path, i.e., X:\SomeFolder\abc\). Once again, the folder name cannot contain spaces. If the folder you need to exclude does have spaces in its name, you'll have to identify and use a string that is a part of the folder name that doesn't have spaces and is unique to that folder. Note that when specifying folders for the /EXCLUDE switch, the folder name must always have a backslash (\) before and after it, even if it stands alone.

* While spaces cannot be used in the /EXCLUDE portion of the xcopy command, they can be used in the source and destination paths for xcopy as long as there are quotation marks (") before and after the complete path name. For safety's sake, it's best to always use quotation marks at the beginning and end when specifying the source and destination paths for xcopy, since the quotation marks don't affect anything other than names with spaces, and if you make a habit of using them, you won't forget to use them when they're necessary.

Taking all this into consideration, your command would look something like this:

xcopy "X:\SomeFolder\" "Y:\SomeFolder Backup\" /c /d /e /h /r /y /exclude:C:\whatever\exclude_abc.txt

/c tells xcopy to ignore any errors that occur and continue copying the files and folders specified. With this switch, if there's a problem related to a file or folder that you've told it to copy, it will just move on to the next file or folder. Without the /c switch, it will abort and send an error message, skipping those files it hasn't gotten to yet.

/d tells xcopy to copy only those files that have a date stamp that is newer than the date stamp of the destination file. This can save a lot of time when executing the command.

/e tells xcopy to copy folders and subfolders, including empty folders. If you don't want it to copy empty folders, use the /s switch instead. If you don't include /e or /s, xcopy will only copy the files in the folder you specify as the source folder -- it will ignore subfolders.

/h tells xcopy to copy hidden and system files. Without the /h, xcopy will ignore any file or folder with the H (hidden) attribute.

/r tells xcopy to overwrite read-only files in the destination path. If you intend to use the same xcopy command mulitple times, like I do in my automated backup procedure, and there are any files or folders that have the R (read-only) attribute in the source folders, /r ensures that these read-only files and folders are copied each time (if the source file is newer than the destination file). Without the /r, they will be copied the first time, but they'll trigger an error every time afterward, because the destination includes read-only files or folders with the same names . Since we're using the /c switch to tell xcopy to ignore errors, it will just skip the files and folders that already exist in the destination folder and have the R attribute.

/y tells xcopy to suppress prompting to overwrite existing files. Without this switch, xcopy will pause for each file and folder that already exists in the destination path and ask you whether or not you want to overwrite the destination file or folder.

gadi_sam
Newbie
Newbie
Posts: 23
Joined: Sun Apr 22, 2012 9:37 pm
Windows Version: XP
Avant Version: 2012 build8
IE Version: 8

Re: More protection for your profiles

Post by gadi_sam » Wed Mar 27, 2013 9:08 pm

Thank you very much for the very detailed explanation!
Now it works!

The only drawback of xcopy is that the newly created folders have today's dates and not their original ones. But that obstacle could be overcome only by using 3rd party software, like FastCopy.

mbrazil
AvantGuard
AvantGuard
Posts: 1966
Joined: Tue Jul 26, 2005 10:04 pm
Windows Version: 10
Avant Version: 2015 Ultimate Build 28
Default engine: Gecko (Firefox)
IE Version: 10
Skin: Monai XP
Location: Grass Valley, CA

Re: More protection for your profiles

Post by mbrazil » Thu Mar 28, 2013 5:36 am

For the purpose of the profile backup, the date stamp on the destination folders shouldn't matter. Xcopy doesn't really change the dates on the folders, as the folders at the destination path actually are new folders the first time you execute the xcopy command or run the batch file that contains it. Each time the batch file executes after the first time, the destination folders already exist (almost all of them, anyway), so xcopy doesn't change the date and time stamps of the folders that are already there.

Also, xcopy doesn't alter the date and time stamps on the files it copies. The date and time stamps on the files in the destination path, including those in subfolders will always be the same as the date and time stamps of the source files.

If you'd like to have an easy way to change the date and time stamps on files and folders, download and install Attribute Changer from http://www.petges.lu/home/download/. Attribute Changer is a shell extension, so once it's installed, when you right-click on a file, folder, or a group of selected files and/or folders, you'll see a new command in the context menu: Change Attributes... When you click on this command, you'll get a dialog box that allows you to change all the file attributes, including the date and time stamps (Created, Modified, and Accessed) for the selected files and folders. I've used this for quite awhile, and it's the easiest way to change date and time stamps that I've come across. I think you'll like it.

gadi_sam
Newbie
Newbie
Posts: 23
Joined: Sun Apr 22, 2012 9:37 pm
Windows Version: XP
Avant Version: 2012 build8
IE Version: 8

Re: More protection for your profiles

Post by gadi_sam » Thu Mar 28, 2013 10:34 pm

Thanks once again!

Post Reply