How to solve the problem of file synchronization. Backing up and synchronizing files in FreeFileSync Standard windows synchronization with a network share

March 31st is international backup day. Apparently because April 1 is the day of those who do not. While the system administrator usually solves the backup problem in the office, for those who work at home, it must be solved by himself. FreeFileSync is a great tool for backing up and synchronizing data.

Organization of backups

There are two aspects to consider when organizing backups. First, the more backups there are, the higher the likelihood of data leakage from them. Second, the more geographically the copy is kept from the original, the more chances of its preservation. A good option is to make backups to a remote computer via a VPN connection, then they are not afraid of a flood or fire. But not everyone has such an opportunity, so we will consider backup and synchronization to an external hard drive.

Do not forget about the relevance of copies, for which you should carry out periodic synchronization. You can, of course, copy the entire amount of data anew each time, but this will only work if there are not many of them. For large volumes, this will lead to unnecessary wear and tear on the hard drive and, in general, a waste of time. Synchronization is much faster than full backup, but it is very important to set it up correctly. Otherwise, you may lose both the copy and the original data! Before using synchronization, be sure to test it on unnecessary files and folders!

Setting up synchronization in FreeFileSync

After installation, launch the program and select the folders for synchronization. On the left is the original folder, and on the right is the backup on your external hard drive.


Then, go to the file comparison settings and select the parameters. By default, files are compared by date and size. On the Filter tab, you can configure the folders and files that you want to exclude from synchronization.

On the "Synchronization" tab, set up the synchronization mode. There are 4 modes in total:

  • Both sides - changes are tracked on both sides of the sync.
  • Mirror - only changes on the left side are taken into account, that is, files and folders that do not exist on the left will be deleted during synchronization.
  • Update - files are copied from left to right, and if new files are found on the right, user intervention is required.
  • Selective - you can configure your own rules for processing files.

Configuring Scheduled Synchronization

FreeFileSync has a useful feature - it saves the sync settings as a batch file. To create this file, click the "save as batch job" button. If necessary, you can enable the recording of synchronization logs.

When this file is launched, synchronization is performed in hidden mode, without launching the graphical interface. Therefore, Windows can be configured to run this file on a schedule. To do this, open the Windows Control Panel and find the "Task Schedule" item there. As an example, let's configure the synchronization to start when the computer is turned on. We create a task for all users. In this case, a password must be set on the computer.

Specify "At startup" as a trigger. It is also worth setting a delay in execution so that everything works correctly.

I think each of us asked the question "What kind of Portfolio appears in the Create menu and what is its purpose?" I also wondered what the briefcase is for in Windows. At first glance, it may seem that the Briefcase performs the same functions as the folder, but has a different icon, but this is far from the case. The fact is that you cannot create files and folders directly in the Portfolio, but only copy them into the portfolio and change them. You can only create in subcategories, i.e. in subfolders! This is all due to the fact that the portfolio functionality is designed to perform synchronization between files and folders.

As part of this article, let's find out what a portfolio is for in Windows and consider how it works.

According to Help, Microsoft recommends using the briefcase in two situations, when syncing files and folders from a PC over the network and between a computer and a removable device. I would not use the portfolio for synchronization over the network, since it is much easier to give access to resources to a specific user and he will be able to work with documents through the network. But we will consider synchronization via a removable device!

As a rule, the need for synchronization arises when you work with the same documents on different computers. Hence, you always need to have the latest version of the files. Of course, you can copy and delete the entire folder each time your documents are located, so as not to find out which files have changed. But, if there are a lot of files, then it can take a lot of time. In this situation, the Windows portfolio can help us out.

Create a portfolio at the root of the USB flash drive (RMB \ Create \ Portfolio \ Working documents)

And we will copy files and folders into this Portfolio, with which we are going to work on another computer in the future. It is at the time of copying documents and folders that a link is created between them, thanks to which the comparison of file versions will be performed.

As I said earlier, we cannot create anything in the Portfolio, since there is simply no "Create" item in its menu

But, we can create files and folders inside folders

All this is due to the fact that between files and folders inside the Portfolio there is a connection with those files and folders from where they were copied. If we try to create a file, then it simply will not have a connection, which means that there will be no one to synchronize it with.

After we have worked with documents on another computer (or just with documents in our Windows Portfolio), we can perform synchronization (copy changed files and folders).

To do this, we can either right-click on the Portfolio and select "Update All"

Or go to the portfolio and on the toolbar click "Update all objects"

As you can see from the screenshot, since the last sync I made changes to the Partnership file and created a UUUUIIIIII file in a subfolder. So during the update, the "Partnership" file will be replaced, the UUUUIIIIII file is created, and thus on both sides there will be identical files.

To get more detailed information, you can right-click \ Details and if any non-standard situations arise (both files have been updated since the connection with the portfolio was created), make the right decision.

Also, by going to (File (folder) properties \ Status), you can see the information with which file (folder) it is associated.

And also update a separate file, separate it from the original and find the original to which the file or folder is attached.

Thank you very much for sharing this material! :-) Our Learning Center will not forget you!

After the article about a purely manual method of folder synchronization requests to find and describe a "lazy" solution to this issue were poured in. Keep - a free program for automatic folder synchronization called Allway sync.

Why do you need folder sync

This question surprised me by some users in the comments and mail - I answer them. You may need it ...

  • if you want to be on the safe side after the transfer any system folder or temporary data to another disk
  • if there was not enough time to finish a project at work / at home (came home / to work, plugged in a USB flash drive and are already working with automatically updated data)
  • if you need to store a backup copy of important data on an external storage medium (hard disk, ssd-drive, flash drive ...)
  • if you need to quickly and losslessly provide data exchange between several computers
  • to facilitate and speed up manual copying of data between folders and disks

Automatic folder sync

Allway Sync software, as the manufacturers themselves assure us, “uses innovative algorithms to synchronize your data between desktops, laptops, USB drives, remote FTP / SFTP and WebDAV servers, various online data warehouses etc. Data compression and encryption are supported. It combines bulletproof reliability with an extremely simple interface. "

Well, they managed to intrigue us, right? Let's put their application to the test.

Installing Allway Sync

There is nothing terrible or confusing about it. Only two nuances - NOT uncheck the installation special service (needed to automatically track changes in folders) ...

... and also decide if you need desktop shortcut and do you install the program for all users of your computer ...



Setting up Allway Sync and working in it

Immediately after installing the program, you need to teach it your language ...

I will show the rest of the program settings as it is tested. So, by default we already have some kind of task called "New Job 1" - right-click on the tab and create our own personal new task ...

After that, you can rename or delete any task in the same way. We figured it out - go ahead and specify the folders for synchronization ...

... we determine the direction of synchronization (the "Change" link between the arrows in the middle) ...

Carefully! Useful additional information on the website:

(the default is general sync)

If you, like me in this case, have the second folder on a USB flash drive, I recommend pressing the "Configure ..." button and check the box to link the program to the characteristics of the drive ...

As you can see, they explain everything competently and clearly to us literally at every step in this wonderful program.

Primary manual sync

I press the Analyze button, read the warning and ignore it ...

... and then, finally, I sync the folders ...

Opening in explorer tabs both experimental folders at once, checked the result of the Allway Sync program - everything is clear and without errors (how many files in one folder, so many files in the second).

This is all well and good, but it was just a simple manual sync - where is the automatic sync? I'm telling you.

Automatic data synchronization

We go into the settings of our task, which can be accessed in several ways ...

  • item "View" in the program menu and "Settings ..."
  • right-click on the task tab and in the context menu the "Properties" item
  • in english keyboard layout click "Hotkeys Ctrl + O (sequentially, no plus)

(by the way, here and program autostart can be turned on)

... at the very bottom of the list of settings, on the left in the window, we look for our task and go to "Automatic synchronization" ...

... and here you can customize it for yourself, whatever you like - when you connect the drive to your computer, after a certain period of time, when you start the application, before exiting ...

The variety of conditions for automatic folder synchronization in this program is simply amazing - the authors have foreseen most of the desires of users.

I set the first condition ("When connecting a removable device") and removing the USB flash drive from the laptop deleted three photos in the test folder. After connecting the drive to the computer, the data was automatically instantly synchronized ...

To synchronize files with other computers and devices in Windows 8.1, there is the Windows Mobility Center, which is linked to the Synchronization Center. It is in Windows Mobility Center that you can manage any devices and associate your account with another computer or Windows server. Devices include both smartphones and tablets. If you manage your device via ActiveSync, then synchronization is usually set up via Microsoft Exchange.

Sync Center lets you manage your synced devices. A device for syncing with a computer may already be connected, but using the Synchronization Center, you can also save an offline version of files for working on the go.

On the sync settings page, you can view your current sync links and any conflicts that may arise.

In order to check if everything is in order, you can view the current status of synchronization with devices.

To sync files with another device on Windows 8.1, click " Setting up a new sync relationship". Please note that another device must be connected to your computer. When you select a sync in the Sync Center, buttons appear at the top of the list to set the sync schedule.

You can click on them and manage your sync options.

If you use Synchronization Center to save offline copies of files on a Windows server to control your synchronization settings, click the " Offline file management».

In the Offline Files dialog box, you can control the current state of synchronization, including the ability to specify the amount of disk space available for synchronization on your computer. To do this, use the tab “ Disk Usage". The more available disk space, the more files you can sync with your computer and store locally.

This dialog also allows you to ensure that offline files are automatically encrypted. This option is very useful if you keep offline versions of files on your laptop.

Setting up and using working folders.

If your company uses the Work Folders feature, managing the system for keeping offline versions of files for the user is much easier and easier. Working folders are located in the control panel. To get started, press the button " Configure working folders”, And you are asked to enter a work email address or work folder URL on the company server.

After the first synchronization of files and folders, the working folders pane displays the progress of the current synchronization of files from the server. This panel can be used for both general file sync control and specific uses, such as which files to sync over a mobile broadband connection. This is where working folders are turned off.

Synchronized work folders appear in the " My pc»File explorer, where it can be easily opened and viewed.

The directory is read using the get-childitem command. The -recurse option is added to the subfolders to be counted, and the PSIsContainer () function is used to distinguish files from folders. If it returns True, then the item is a folder, otherwise it is a regular file:

$ source = ¨c: files¨

$ srcfolder = get-childitem $ source -recurse | where-object ($ _. psiscontainer)

$ srcfiles = get-childitem $ source -recurse | where-object (! $ _. pciscontainer)

To solve our simple task, four lists are required: the first two contain the source files and folders, and the remaining two contain the resulting files and folders. The synchronization process boils down to iterating over these lists and copying files from one folder to another.

The first loop checks if the source directories exist in the backup folder, and if they do not already exist, they are created using the new-item command.

foreach ($ folder in $ srcfolders)

$ srcpath = $ source -replace ¨ \ ¨, ¨ \ ¨ -replace ¨: ¨, ¨: ¨

$ dstpath = $ folder.fullname -replace $ srcpath, $ destination

if ($ dstpath -ne ¨¨) (

if (! (test-path $ dstpath))

¨Creating the ‘$ dstpath’ folder.

new-item $ dstpath -type directory | out-null

A very similar loop is performed when comparing the resulting and original folder list, thereby creating the exact structure of subfolders. The other two loops process files: the first one copies the updated objects from the source to the target folder, the second - those that are not in the source directory - from the final one. You can find out if a file has been updated by its hash code. Note that because files are opened read-only, they are not blocked from being used by other programs. However, according to the rules of good taste, the file must be closed with the Close () function at the end of the hash code calculation:

$ md5 = new-object system.security.cryptography.md5cryptoserviceprovider

$ fs = new-object system.io.filestream ($ file, $ mode, $ access)

$ hash = $ md5.computehash ($ fs) # file hash code

$ fs.close ()

It is pointless to overwrite a newer file with its old copy, and therefore we will add commands to compare modification dates. When moving back files that are not in the source folder, no checks are required, you just need to execute the copy-item instruction. The entire script is shown in the listing - the paths to the source and destination folders are passed to it (do not forget to add closing slashes, for example, c: filessource), and then it does all the work on its own and only displays information on the screen of what is happening. Note, even if you have not previously created the resulting folder, the script will create it on its own:

if (! (test-path $ destination))

new-item $ destination -type directory -force | out-null

So, this script will help you copy photos, tables, text documents, etc. that are not on a flash drive, without wasting time on manual file-by-file comparison. To use it, you can create a simple BAT file on the Desktop by specifying a command of the form powershell.backup.ps1 c: filessrc d: backup (the path to the script usually needs to be given in full). It is easy to sync folders later by clicking on this batch file. Recall that the command Set-ExecutionPolicy RemoteSigned, executed on behalf of the "Administrator", allows execution of unsigned scripts.

Keeping copies of important files in a completely unprotected form is perhaps not entirely correct from a security point of view. Despite Microsoft's best efforts, Windows 7 remains vulnerable to viruses, worms, and other malware. They get to documents that are constantly in the public domain without any problems. Fortunately, a very useful feature has appeared in the operating system - virtual disks that are mounted and disconnected on the fly. They are also suitable for backing up any important files that can be accessed by a limited number of users.

A virtual disk is presented in the system as a VHD (Virtual HardDisk) file, which has a complete structure and content similar to those of a hard disk. It is created using the Windows 7 built-in computer management utility that runs through the compmgmt.msc module. In the window of this program, you need to click on the "Disk Management" line and select the "Action Create virtual disk" command from the menu. The new virtual disk is sized and then the volume is formatted. In the last step, you can assign a drive letter or bind the VHD file to an NTFS folder.

The last method is interesting in that it is allowed to copy to a specific folder regardless of where the virtual volume is located. By unmounting a virtual volume in a computer management utility, you can be sure that neither viruses nor curious users will get to the latest copy of important documents. The virtual volume itself, that is, the file with the VHD extension, can be copied to the backup media. An additional security measure is virtual volume encryption, which is available using BitLocker to users of the maximum and business versions of Windows 7. When connecting such a protected volume (and it can be used on other PCs, even where BitLocker is not installed), Windows will ask for a login and password.