# Synchronizer

## Introduction

This function compares two directories with all subdirectories and shows the differences between them. After selecting some options and the Compare function you can synchronize the files and directories. One panel could be an &FTP; server. Do not forget the Compare by content option if the file size stays equal. Choose Tools Synchronize Directories or &Ctrl; Y to start this feature. The colors are configurable. The synchronizer has its own keybindings.

For local files: The synchronizer changes the date information to the original dates.

### Synchronizer

Synchronizer

### Procedure:

1. Set the Left directory and the Right directory that you want to compare.

2. Configure the optional File Filter, General Filters and Advanced filters. The General Filters includes a Do not search in option which lets you exclude directories from comparision.

3. Set the Checkbox options: Recurse subdirectories, Follow symlinks, Compare by content, Ignore Date, Asymmetric and Ignore Case.

4. Click on the Compare button to compare the directories.

5. By using Show options, you can include/exclude particular file types. The files that are not on the list will be untouched by synchronization.

6. If needed, you can change the Task operations determined by the Comparator with the right click menu.

7. When you agree with the Compare results, click on the Synchronize button to show the synchronize dialog.

8. After selecting the options of the Synchronizer, click on the Start button to start the synchronization process.

A detailed explanation of all the functions and buttons is described in the following text.

## Comparator

Panel elements

  - Left Directory: The left side base directory.

  - Right Directory: The right side base directory.

  - File Filter: Filters the filenames at synchronizing. &eg; `*.png` selects only files the names of which end with `.png`. Directories are listed if the directory name ends with `.png` or if the directory contains files which end with `.png`. Multiple include/exclude example: `'*.cpp *.h | *.moc.cpp'` includes `*.cpp *.h` and exclude `*.moc.cpp`.

  - General filters: Search for, containing text

  - Advanced filters: Size, date, ownership

Filename filtering criteria

  - You can make use of wild cards. Multiple patterns are separated by space (means logical OR) and patterns are excluded from the search using the pipe symbol. If the pattern is ended with a slash (*pattern*/), it means that pattern relates to recursive search of directories.

  - pattern - means to search those files/directories whose name is a pattern, recursive search goes through all subdirectories independently of the value of the pattern.

  - pattern/ - means to search all files/directories, but recursive search goes through/excludes the directories whose name is a pattern.

  - You can use quotation marks for names that contain spaces. Filter "Program Files" searches out those files/directories the name of which is `Program Files`.

  - Examples:

  - `*.o`

  - `*.h *.c??`

  - `*.cpp *.h | *.moc.cpp`

  - `* | CVS/ .svn/`

  - Note: the search term 'text' is equivalent to '*text*'.

Checkbox options

  - Recurse subdirectories: The Synchronizer walks through subdirectories when comparing.

  - Follow symlinks: The Synchronizer follows the symbolic links to directories (not the files!).

  - Compare by content: The files the sizes of which are equal will be compared by content as well.

  - Ignore Date: Ignores the date information (useful for &FTP;, smb, archive, ... ) the date information is relevant *only* in the local file system.

  - Asymmetric: The Left Directory is the target directory, the Right Directory is the source directory. This function synchronizes the content of the left directory to the right directory.

    - The files that exist only on the left side will be deleted.

    - The files that exist only on the right side will be copied to left.

    - The files considered to be equal will be untouched.

    - Those files considered to be different will be copied to left. Use this feature with care!

    This function is useful if the date information is unusable, or to synchronize the left directory to the content of a file server (like a download). Alternatively, it is useful to make a backup from the right directory to the left directory. NOTE: Do NOT use this option to synchronize a desktop and a notebook (&eg; files that exist only on the left side will be deleted!).

  - Automatic Scrolling: This is for slow &FTP; servers, ... When the Synchronizer has finished comparing a file, it puts the file into the end of the list at once and scrolls the window, if necessary. It is important, if you want to know what the Synchronizer is doing. If the &FTP; server is slow, the comparison of a directory may take a lot of time. By turning this option on, you can see that the comparator is "alive", but slow. For fast file systems, it can reduce the speed of comparing slightly.

  - Ignore Case: Case insensitive filename compare, this is useful when synchronizing &Windows; filesystems.

  - Ignore hidden files: Ignores files that start with a dot.

When everything mentioned above is done, click on the Compare button to compare the directories, the results are displayed in the File List.

File List

  The File List has the following columns: "Left name | Left size | Left time | Task | Right time | Right size | Right name". Here you can check the compare results and modify the synchronisation actions if desired. The text color defines the default copy direction determined by the comparator.

  - Green: Copy from left to right.

  - Blue: Copy from right to left or delete on the right side in asymmetric mode.

  - Red: Files which are different by the given criteria (no copy direction).

  - Black: Files which are identical (no copy direction).

  A double click on a file calls the &krusader;s Compare by content function. The Tasks (<=>) column defines the default copy direction, which can be modified by the user if needed. The results window supports dragging items to other windows ( drag [left], &Shift;+drag [right] ) and copy left/right selected items to clipboard (&Ctrl;C).
File List: Tasks (<=>) column

  This column displays the task that is planned for the Synchronizer, this task can be modified with the right click menu.

  - ->: Copy from the left side to the right side. For directories: `mkdir` in the right side.

  - =: The files are the same, do not do anything.

  - !=: The file is excluded, or the Synchronizer does not know what to do.

  - <-: copy from the right side to the left side. For directories: `mkdir` in the left side

  - DEL: delete files from the right side.

Show options

  Here you can include/exclude particular file types. Those files, that are not in the list, will be untouched at synchronization.

  - ->: Enable/Disable the copy task from left to right.

  - =: Enable/Disable listing the equal files.

  - !=: Enable/Disable listing the excluded / "do not know what to do" files.

  - <-: Enable/Disable the copy task from right to left.

  - Trash: Enable/Disable the file deleting from the left side task.

  - Duplicates: Enable/Disable those files that exist on both sides.

  - Singles: Enable/Disable those files that exist only on one side.

Action buttons

  - Compare: Compares the directories, the results are displayed on the File List.

  - Stop: Stops comparing.

  - Synchronize: Shows the synchronize dialog.

  - Close: Closes the Synchronizer window.

The Status line may contain

  - The number of scanned directories while comparing.

  - The filename when comparing by content (for big files).

  - The number of files on the list.

Right click menu on the File List

  The right click menu is split up in three sections:

  1. change the Task operations determined by the Comparator. Select one or multiple files. The change will be applied on the selection and not only on the right clicked item. If the selected item is a directory, the change will be applied on its files/subdirectories as well.

  - Synchronize Directories: Starts synchronization.

  - Exclude: Excludes a file/dir from synchronization ( task change to != ).

  - Restore original operation: Task change to the original result of comparison.

  - Reverse direction: Task change ( -> to <-, and <- to -> ).

  - Copy from right to left: Task change to <-.

  - Copy from left to right: Task change to ->.

  - Delete ( left single ): Task change to DEL.

  2. change the selections

  - Select items: Opens a dialog which allows you to select items. This is the Select Group dialog from the Edit menu.

  - Unselect items: Opens a dialog which allows you to deselect items. This is the Unselect Group dialog from the Edit menu.

  - Invert selection: Invert the selection status of all items.

  3. others (note that the following operations work on the right-clicked file and not on the selection).

  - View left file: Starts viewer on the left file.

  - View right file: Starts viewer on the right file.

  - Compare Files: Starts the diff utility (&eg; &kompare;) on the files.

Other buttons

  - Profiles: If you have to synchronize the same directories often, you can save the settings &eg; include files, exclude files, ... Press the Profile button, and you will be able to add / load / save / remove synchronizer profiles.

  - Swap sides: Swaps the File List.

Synchronize with kget

  If you want to synchronize a local directory with an unstable &FTP; server, kget is a much better solution than simple file copying. After comparing you may right click on the result list and select Synchronize with KGet to execute the synchronization, after that the listed files will be downloaded with kget instead of &krusader;. Of course kget needs to be installed on your computer; otherwise, it will not be available.

## Sychronisation

After pressing the Synchronize button the synchronization dialog appears.

Check boxes

  Here you confirm the copy and delete operations of the Synchronizer

  - Right to left: copy X1 files ( Y1 bytes ) enable / disable the copy from right to left.

  - Left to right: copy X2 files ( Y2 bytes ) enable / disable the copy from left to right.

  - Left: delete X3 files ( Y3 bytes ) enable / disable the left side deleting.

  - Confirm overwrites: By switching this option on, Krusader will show the rename, skip, overwrite, skip all, overwrite all dialog box, before overwriting the file.

Status labels

  - Ready: A1/A2 files, B1/B2. This line is changed at synchronizing, showing that synchronizer finished with A1 files from A2 ( B1 bytes from B2 ).

  - Progress bar: Shows the progress on the synchronization (based on bytes).

Action buttons

  - Start: Starts synchronization.

  - Pause / Resume: Pauses/resumes the synchronization process.

  - Close: Closes the synchronization dialog (and stops synchronization).

Parallel synchronization

  - One can give the number of the 'quasi' threads.

  - Can drastically increase the speed when synchronized with slow &FTP; servers.

  - Does not affect the speed of local synchronization.

  - Remote "compare by content" and "directory compare" is done in parallel.

  - Remote synchronization is also done in parallel, except the mkdir tasks (mkdir must be before copy).