# Visualizations

## Visualize synchronization status

When comparing your directories, say `left` and `right`, use `display_sync_status()` for an effective comparison visualization.

As with any function from `syncdr`, you will have to call `compare_directories()` first:

### Example when comparing directories by date & content

    library(syncdr)

    # Create syncdr env with left and right directories
    .syncdrenv =toy_dirs()
    #> ■■■■■■■■■                         27% | ETA:  8s
    #> ■■■■■■■■■■■■■■■■■■■               60% | ETA:  5s

    # Get left and right directories' paths
    left  <- .syncdrenv$left
    right <- .syncdrenv$right

    sync_status <- compare_directories(left,
                                       right,
                                       by_content = TRUE)

`display_sync_status()` allows you to visualize the synchronization status of either (1) common files or (2) non common files, as you can see in the examples below:

    display_sync_status(sync_status$common_files,
                        left_path  = left,
                        right_path = right)

    display_sync_status(sync_status$non_common_files,
                        left_path  = left,
                        right_path = right)

## Visualize directories structure

Moreover, you have the option to utilize `display_dir_tree()` for a swift overview of your directory(ies) structure, whether for a single directory or both simultaneously.

    # Tree structure or right directory
    display_dir_tree(path_left = left)
    #> (←)Left directory structure:
    #> C:/Users/wb621604/AppData/Local/Temp/RtmpspeU5x/left
    #> ├── A
    #> │   ├── A1.Rds
    #> │   ├── A2.Rds
    #> │   └── A3.Rds
    #> ├── B
    #> │   ├── B1.Rds
    #> │   ├── B2.Rds
    #> │   └── B3.Rds
    #> ├── C
    #> │   ├── C1.Rds
    #> │   ├── C1_duplicate.Rds
    #> │   ├── C2.Rds
    #> │   └── C3.Rds
    #> ├── D
    #> │   ├── D1.Rds
    #> │   ├── D2.Rds
    #> │   └── D3.Rds
    #> └── E
    #>     ├── E1.Rds
    #>     ├── E2.Rds
    #>     └── E3.Rds

    # Tree structure of left directory
    display_dir_tree(path_right = right)
    #> (→)Right directory structure:
    #> C:/Users/wb621604/AppData/Local/Temp/RtmpspeU5x/right
    #> ├── A
    #> │   ├── A1.Rds
    #> │   ├── A2.Rds
    #> │   └── A3.Rds
    #> ├── B
    #> │   ├── B1.Rds
    #> │   ├── B2.Rds
    #> │   └── B3.Rds
    #> ├── C
    #> │   ├── C1.Rds
    #> │   ├── C1_duplicate.Rds
    #> │   ├── C2.Rds
    #> │   └── C3.Rds
    #> ├── D
    #> │   ├── D1.Rds
    #> │   ├── D2.Rds
    #> │   └── D3.Rds
    #> └── E
    #>     ├── E1.Rds
    #>     ├── E2.Rds
    #>     └── E3.Rds

    # Tree structure of both
    display_dir_tree(path_left = left, path_right = right, )
    #> (←)Left directory structure:
    #> C:/Users/wb621604/AppData/Local/Temp/RtmpspeU5x/left
    #> ├── A
    #> │   ├── A1.Rds
    #> │   ├── A2.Rds
    #> │   └── A3.Rds
    #> ├── B
    #> │   ├── B1.Rds
    #> │   ├── B2.Rds
    #> │   └── B3.Rds
    #> ├── C
    #> │   ├── C1.Rds
    #> │   ├── C1_duplicate.Rds
    #> │   ├── C2.Rds
    #> │   └── C3.Rds
    #> ├── D
    #> │   ├── D1.Rds
    #> │   ├── D2.Rds
    #> │   └── D3.Rds
    #> └── E
    #>     ├── E1.Rds
    #>     ├── E2.Rds
    #>     └── E3.Rds
    #> (→)Right directory structure:
    #> C:/Users/wb621604/AppData/Local/Temp/RtmpspeU5x/right
    #> ├── A
    #> │   ├── A1.Rds
    #> │   ├── A2.Rds
    #> │   └── A3.Rds
    #> ├── B
    #> │   ├── B1.Rds
    #> │   ├── B2.Rds
    #> │   └── B3.Rds
    #> ├── C
    #> │   ├── C1.Rds
    #> │   ├── C1_duplicate.Rds
    #> │   ├── C2.Rds
    #> │   └── C3.Rds
    #> ├── D
    #> │   ├── D1.Rds
    #> │   ├── D2.Rds
    #> │   └── D3.Rds
    #> └── E
    #>     ├── E1.Rds
    #>     ├── E2.Rds
    #>     └── E3.Rds

    # Restore options
    options(old_options)