qFileSync v2.0
A File Synchronization And Backup Program
July 18, 2001
Table Of Contents:
Disclaimer
I do not claim that this software is reliable. I will accept no liability for data loss
caused by the use of this program! And frankly, it would be foolish to attempt to sue me
for liability since I am practically penniless. I mean, I could not even pay for a
lawyer to properly write the first two sentences for me (which, by the way, I intend to be
legally binding) along with a whole nother page of gibberish to cover all the legal bases.
Revision History
There comes a time in every product's life cycle where the Second Major Release comes.
Now it's FileSync's turn...
New in qFileSync v2.0 Build 65
- OH NO! That little bug fix in 2.0 "final" caused a much
larger problem: if a folder was selected when you started a synchronization, that folder's
mode would be changed to "mirror". This is caused by a quirk in VB which I
have encountered before, but forgot when I did the "bug fix".
- Some people have had a problem when the file systems differed between the folders to be
synchronized. This is probably caused by a difference in time resolution between the
file systems, and I've fixed it by calling two dates within one second of each other to be
equal. I have tested the new code in the usual way (by synchronizing my personal
files) but remember, I am free of liability!
New in qFileSync v2.0 Final
- May 3, 2001: Fixed a tiny little bug; changed version from Beta 4 to Final
- August 11, 2000: Fixed case sensitivity problem
- June 14, 2000: Fixed fatal minimization bug
- Can resize main window horizontally when log is showing
- Changed to Confirm dialog box to show, in the list box, which directory has the most
up-to-date file.
New in v2.0 Beta 3
- Spaces at beginning of filename allowed
- "Sync all sets" works
- Sorting algorithm bug fixed
- Made the the help option do something (namely, show this file)
New in v2.0:
- Name has been changed from FileSync to qFileSync. Why? A certain company complained to
me that my program's name conflicted with theirs. I could have just squealed "Screw You" and scampered away, but I didn't. But if anybody
wants another name change... well, forget it.
- Interactive synchronization dialog box. This allows you to verify and change the
program's actions before they are taken. This is the most major new addition.
- Mirroring feature: you can now mirror a directory tree, in addition to backing up and
synchronizing.
- Folder name filters: you can now specify filters on subfolder names.
- New user interface
- Simulated (fake) synchronization
- About box
New in v1.5:
- New command-line switches: /Q, /A, /L, /LR, /?
- Command-line switches can be referred to with a dash now: -S, -ST
New in v1.45:
- I have added a "Date Warning" feature, which warns you before transferring a
file that has a date in the future. I added this feature after I lost about 20 hours of
work when my laptop's system clock messed up.
- The current date is now shown in the title bar. Don't worry, it's Y2K compliant. It'll
be about 2021 before it actually fails. ;^)
New in v1.4:
Installing qFileSync
qFileSync does not need to be installed; it's ready to run as soon as you download it.
Of course, if you want it to have a sense of being installed, you can move it to your
C:\Program Files directory and place a shortcut to it on your desktop or start menu.
Basic Usage
 |
Let's say you want to synchronize the contents of C:\WebPage and
\\Primary\c\WebPage (\\Primary being the name of a networked computer.) I do it all the
time; those locations contain my web page.
Anyway, you just type in each of the folder names under Directories to
synchronize and click Add each time. Alternately, you can
- Click Browse... and click around to find the folder
- Drag a folder from Explorer directly onto the list.
If you want the contents of sub-folders to be sync'd (the entire directory tree), make
sure Recursive is checked. If you want qFileSync to be able to copy files
that are found in one folder but not the other, choose Yes or Ask
Me for Auto-Create files.
When you're satisfied that the settings are correct, click Quick Sync
to perform the synchronization. |
Beware! This program can be dangerous because there's no way to
"undo" a synchronization. So, step one before you try using this program is to
make sure that the system clock on all systems involved is correct, and file integrity is
okay when you're syncronizing with a floppy.
More Features
Filters (wildcards)
Filters tell qFileSync what files to pay attention to and to ignore. If you're a
seasoned DOS/Windows user you'll know how to use them already.
The extension part of the filename is matched separate from the name part; for example,
if your spec is "*.htm*", and a file is called "hello. Have a nice
day.html", then
- "hello. Have a nice day" is matched against "*", which is a positive
match.
- "html" is matched against "htm*", which is also a positive match.
- If either part comes back negative, then it is considered a negative match. The matching
is not case-sensitive.
Supported wildcard forms:
- Star at beginning: e.g. *hello matches hello and abcdhello, but not olleh or helloabcd.
- Star at end: e.g. hello* matches hello and helloabcd, but not hidude or abcdhello.
- Star in middle: e.g. he*en matches heaven and heen, but not crappyheave or hen.
- Stars on end: e.g. *quit* matches quite, noquitting, and "I Quit, I Really
Quit!".
You can't put multiple stars in any other form: *a*b*c is invalid, and so is a*b*. Such
forms will never match.
You can also use question marks. For instance, ????* forces the filename to be at least
four characters long, and mp? will match mp2, mp3, and mpx but not mp22, mp, or mymp3.
FileSync behaves differently if your filespec is missing the dot (.) or if there is
nothing on the left or right side of the dot.
- If there is no dot (e.g. "hello") then any extension matches.
- If there is nothing on the left side of the dot (e.g. ".txt") then any
filename matches.
- If there is nothing on the right side of the dot (e.g. "hello.") then a
filename matches only if it has no extension.
You can separate multiple filters with semicolons; for example: *.txt;*.doc
There are four text boxes into which you can type filters:
- Filename filters: specifies what files to synchronize; this defaults to
*.* (all files).
- Exclusion filters: specifies what files NOT to synchronize,
notwithstanding the first box. For example if your filename filter is "*.doc"
and your exclusion filter is "mydoc.doc", mydoc.doc will not be synchronized.
- Folder filters: this filter (new to v2.0) is only available when doing
a recursive synchronization. It specifies what folders to recurse into. This defaults to
*.*.
- Folder exclusion filters: specifies what folders not to recurse into.
For example, if you put "Bitmap" in here, then the contents of any folder named Bitmap
will be ignored. For example, when I'm programming, my compiler puts intermediate files in
folders named "Debug". So, I put Debug in as a Folder
exclusion filter.
Sync modes
Each folder has a synchronization mode. For the purposes of this section,
assume you are to synchronize two directories, A and B.
At least one of the folders must always be set to Sync with this path
mode, so assume A is set up this way. If B is set to...
- Sync with this path: A normal synchronization is performed. Files with
more recent dates in A are copied over older files in B,
and vice versa.
- Backup to this path: The folder can act as a destination for files
only, never a source. If B contains a file File.txt, for
example, that is newer than the same file in A, it is not copied over.
But files in A can be copied to B.
- Create a mirror at this path: Provided that Auto-Create files
is set to Yes (as it should normally be when using this option) Any
actions necessary are taken to ensure that B is a mirror of A.
For example, if a file exists in B but not in A, the
file in B is deleted (Mirror to is the only mode that
will delete files). If a file in B is older or
newer than the same file in A, the file in B is
overwritten with the file in A.
You can synchronize between three or more folders; this is just a logical extension of
synchronizing two folders.
Auto-Create files
As mentioned previously, The "Auto-Create" option specifies what to do when a
file exists in one directory but not the other. If "Yes", files from one folder
will be created in the other folder automatically. If "No", updated files will
only be copied if they already exist in both locations. If you choose "Ask Me",
it will ask your permission before creating every nonexistant file.
Multiple Synchronization Sets
You can also synchronize more than one SET of folders. That is what the "Sync
sets" menu is for. The first time you run the program, there is only one set, and it
is called "Untitled". (You can rename this set to anything you want by clicking
on the text box containing "Untitled", and typing in a new name.) The set name
is for identification only and has no effect on program behavior.
Use multiple sets when you want to synchronize different sets of folders. For example,
you might want to synchronize your documents, in the directories "C:\My
Documents" and "A:\", and your CAD work, in "C:\CAD\Bill",
"\\OtherComputer\Bill's CAD work", and "A:\CAD". To do this, you need
to create two sets - one called, perhaps, "Documents" and the other "CAD
Work Backup". Put the two document directories in the first list and the three CAD
directories in the second list.
The sets you make need have nothing to do with each other, and can be synchronized
separately. Also, you can have as many sets as you want, limited only by the scope of your
workload :)
Simulated Synchronization
File > Simulated Synchronization
will show you what the program would do were you to do a quick sync... without actually
doing it.
Interactive Synchronization
File > Interactive Synchronization allows
you to verify and change the program's actions before they are taken. When you choose this
option, qFileSync will scan the folders as usual, deciding what should be done, and then
will show the following dialog box:

When you select a file from the list on the left, the action(s) qFileSync was planning
to take are shown on the right.
The filename, date and size of each file is shown, along with the action to be taken:
- Leave alone will do nothing with the file.
- Delete existing file will delete the file.
- Copy From will make a copy of the file from another location.
You can also rename each copy of the file by entering a new name in the Rename
to box. Note: you cannot rename a file to something which
conflicts with the name of another file, nor can you move the file to another directory.
Advanced things like this should be done with a file manager like Explorer.
For example, you can't swap the names of A.txt and B.txt by trying to rename B.txt to
A.txt and A.txt to B.txt. This is because qFileSync performs the operations serially and
and error will occur when either of these files is reached when you click Continue
Synchronizing.
Other things you can do in this dialog:
- Reset to defaults: resets to the actions qFileSync was originally
planning to do.
- Turn off all changes: well, it turns off all changes so you can
selectively re-enable the changes you want.
- Sort by Path & Filename: sorts the list of files, first by path and
then by filename. When the dialog first opens, the files are shown in natural order (i.e.
the order the files were read in from the disk) with directories first.
- Sort by Modification Type: sorts according to the modification type,
which is shown to the left of each filename on the list. Files that have the same
modification type are sub-sorted by path and filename.
The letters/numbers that make up the modification type are as follows:
- 1, 2, 3, etc: You'll see a number most often; it means that a file is
to be copied from the directory with the specified index in the path list. That is, the
path at the top is number 1, and the one underneath is number 2.
- D: One or more files are to be deleted.
- R: One or more files are to be renamed.
- U: User has made a change from qFileSync's originally suggested action.
Click Continue Synchronizing to finish the job.
Exporting Sync Sets
Sorry, qFileSync does not have such a feature. However, that's not to say you
can't do it!
Since the Synchronization Sets are stored in the Windows Registry, you can use the
RegEdit utility to export them to a file. To do this, click Start,
then Run... and paste the following command into the box that
appears:
regedit.exe /e C:\qFileSync.reg "HKEY_CURRENT_USER\Software\VB and VBA Program
Settings\qFileSync"
A file called qFileSync.reg will appear in the root directory of your
C: drive. Copy this file to the machine you want to import to, then double-click on
the file, at which point Windows should proceed ask your permission to import it into the
registry.
Caveats:
- The original sync sets on the target machine will be replaced.
- The first caveat is incomplete. If the target machine originally had many sync
sets, only the first sets will be replaced. e.g. if you import 3 sets from one machine to
a machine with 5 sets, the last two sets will remain.
- This is all theoretical, since I've never actually tried this.
Notes
- UNC (Network) paths are supported.
- When synchronizing to a computer on your network using a UNC path, you may get this
error: "Bad File Name or Number." This occurs when the computer on the network
requires you to "log on" to it first. You can typically fix this problem by
browsing to the directory that represents the hard drive on the computer with which you
want to synchronize. For example, if you are synchronizing with \\Timothy\c\Work\Charts,
browse to \\Timothy\c in an Explorer window before synchronizing. You may or may not have
to enter a password when you do this. This error should not occur with networked
drive letters.
- Users of the previous version of qFileSync will probably notice that all their sync sets
have "disappeared". This is because of the name change; the settings are stored
in the Windows registry according to the name of the program. If you're the adventurous
type, you can import your old settings with some trouble. Start regedit (Start
> Run > regedit), then find the key
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\FileSync and (after deleting the qFileSync
key) rename it from FileSync to qFileSync.
- If you check "Recursive", the entire directory structure of the two folders is
synchronized, with the exception of empty folders (i.e. subfolders are not synchronized
unless they actually contain something.)
- Because of a change in coding, I have to process wildcards manually. I have not tested
my wildcard matching code extensively; if you find something that doesn't work right, let
me know!
- Be sure to use backward slashes rather than forward slashes.
- All the folder lists and their associated settings are saved automatically in the
registry when you exit the program, so you can synchronize the folders again later. If you
mess up your settings somehow, you can also exit without saving settings by choosing File
> Exit Without Saving.
- The "warn about dates in the future" option tells you whenever a file has a
date in the future according to the system clock. From this I discovered a curious
property about synchronizing over a network: if two Windows PCs (A and B) are set to
different time zones, A will see a different time on B's files than B itself will
see. I ran into this when I moved from Calgary to Victoria; my laptop complained
that files on my work computer had dates an hour in the future. In fact, they did
not. Eventually I figured it out and changed the time zone, which caused the
desktop's files' dates to shift by an hour, causing qFileSync to re-copy every single
file...
If there's a moral to this story, it's that you have to make sure your time zones are
correct, not just the system clock...
- The included source code files are not needed for the program to
function... only the .EXE and the VB5 runtime DLL are needed to run this program.
Command-Line Interface
This program is written in Visual Basic, and as such, it requires Windows to run.
Therefore, you can't put it in your AUTOEXEC.BAT. However, if you want a set of
directories to be sync'd automatically when you start Windows, you can do that. Here's
how:
- Create a shortcut to FileSync.exe in the Start Menu under Programs | Startup
- Right-click on the shortcut and choose "Properties".
Where it says "Target", append, in quotes, the name of the Sync Set. For
example, if it said
C:\FileSync\FileSync.exe
then you might change it to:
C:\FileSync\FileSync.exe "Bill's secret documents"
Note: You must include the quote marks! Don't give your Sync Sets names with quotes in
them!
You can list more than one set, for instance
C:\FileSync\FileSync.exe "Bill's monopoly" "Bill's
DoJ sabotage files"
FileSync also supports a number of switches, which are not case sensitive, and can
appear before or after the list of sync sets, or whatever - this program's command line
parser is not stupid like some others I know.
- If you want the main FileSync window to appear during the sync, use /S.
C:\FileSync\FileSync.exe /s "Bill's $40M house
blueprints"
- If you want the window to appear, but only temporarily, use /ST.
The "t" causes the window to close as soon as syncing is completed.
- If neither of these is used, FileSync will run "silently", except to inform
you of errors or ask whether to create a file.
- /Q ("Quiet Mode") will cause FileSync not to
display error messages on screen.
It is highly recommended you use a log file with this switch (/L,
/LR) ... Otherwise if something goes wrong there'll be no
telling what it was.
- /Lpath_and_filename will cause output to be logged to
the specified file.
There cannot be a space between /L and the path, and if the path contains spaces, you need
quotes, as in:
/L"c:\Some dumbarse put spaces\in their
path\SyncLog.txt"
- /LRpath_and_filename will cause the log file to be
cleared before logging begins.
- /A Synchronizes all sets of directories.
The End.
I hope you find this program useful.
Regards,
David Piepgrass
QwertMan@hotmail.com
http://members.nbci.com/Qwertie
P.P.S. Thanks to Terry Meritt for the code for the "Browse..."
button.
qFileSync and its documentation are copyright 2001 by David Piepgrass.