Comparing files and folders
A comparison answers two questions about two things you point at: how different are they, and what exactly differs. For two folders, the first answer is a list with one row per file and a count for each kind of difference. For two files, or for any file in that list, the second answer is a line-by-line view of what changed, in the way a code review shows it.
A comparison opens in a window of its own, so it stays on your screen while you carry on working in the two-pane browser. It belongs to the tab you started it from and uses that tab’s connection.
Starting a comparison
Section titled “Starting a comparison”There are three ways in, and each one needs a connected tab.
| Where | What it compares |
|---|---|
| Right-click a file or a folder, then Compare with Other Pane | The selected entry against the entry with the same name in the folder the other pane is showing. A folder is compared as a folder, a file as a file. |
| Select exactly two files in one pane, right-click, then Compare the Two Selected Files | The two files against each other; the one listed first in the pane is the left side. |
| View → Compare Both Panes | The folder your Mac pane is showing against the folder the server pane is showing, and everything inside them. |
Your Mac is always the left side of the window and the server is always the right side, whichever pane you started from. The one exception is Compare the Two Selected Files, where both files come from the same pane.
Some entries are not offered where they could not give an honest answer:
- Compare with Other Pane is not offered for a link — comparing a link would compare whatever it points at, under the link’s name — or when the other pane is showing a list of buckets rather than a folder.
- Compare Both Panes is switched off while either pane is showing a list of buckets, because it would walk every bucket whose name matches a folder.
The window
Section titled “The window”The top of the window is the overview: a count for each kind of difference, and below it one row for each file found. While a folder comparison is still looking, a line above the list says how many entries it has found so far and offers Stop. Stopping keeps what was found and says that the list is incomplete.
The bottom of the window is the content view. Select a file in the list and its line-by-line differences appear there. Two files you picked directly open straight into the content view, because there is no list to choose from.
What the states mean
Section titled “What the states mean”| State | What it says |
|---|---|
| Only on the left / Only on the right | The path exists on one side only. |
| Same contents | The two files have the same size and their checksums match — or, after you asked for it, their bytes match. |
| Different | The sizes differ, or the sizes match and the checksums do not. |
| Different types | A folder on one side and a file on the other. |
| Not determined | macSCP could not tell. The reason is written beside the row. |
A row never says Same contents on a guess. macSCP looks at the size first, because two files of different sizes differ and that needs no further work. Only where the sizes match does it ask for a checksum, so a folder that has grown costs almost no checksums, and a folder that is an exact mirror costs about one per file. For a file on the server, the checksum is computed by the server, so a large mirrored folder can take a while — that is what the progress line and Stop are for.
When a row cannot be decided
Section titled “When a row cannot be decided”Not determined is the honest answer when the two sides cannot be compared by checksum. The reason beside the row says which of these it is:
| Reason | What it means |
|---|---|
| A side could not provide a checksum | The connection cannot produce one for this file. Some kinds of connection never can, and a server may lack the tool. |
| A side could not compute the chosen kind of checksum | The server lacks that algorithm. Another one can be chosen under Settings → Transfers → Checksums. |
| The two sides answered with different kinds of checksum | The two numbers say nothing about each other. |
| A side offered only the tag of a multipart upload | On S3 storage, a file uploaded in parts carries a tag that looks like a checksum and is not a checksum of the file’s contents. |
| One side is a link | Comparing the contents would compare what the links point at, which is not what the row claims. |
| It could not be established that this is an ordinary file | The listing did not report what kind of entry it is, or it is not a kind whose contents can be compared. |
| macSCP could not read this path | Nothing inside it was compared. |
For most of these, a row offers Compare contents anyway. It fetches both files — they show up in the transfer bar like any other transfer — compares the bytes, and settles that one row as Same contents or Different. It is offered where fetching can answer the question the row asks: the checksum reasons, and an entry whose kind was not reported. It is not offered for a link, because fetching one compares the wrong thing, or for a path macSCP could not read.
Reading the differences
Section titled “Reading the differences”Select a file in the list. macSCP fetches both files into a temporary folder, which also shows in the transfer bar, and compares them line by line:
- A line marked − is only in the left file, a line marked + only in the right file. Lines without a mark are the same in both and are shown around each change for context.
- Changes are grouped into blocks. Each block starts with a header such as
@@ -3,2 +3,4 @@, which says where the block starts and how many lines it covers in the left file and in the right one. - Two files that look the same but are not — for example, one starts with an invisible byte order mark — show the invisible character as a marker, so you can see why they differ.
- If no line differs, the content view says that the two files have the same contents.
Selecting a row is enough to start the fetch. If you move on to another row before it finishes, the fetch for the first one is stopped.
When there is no line-by-line view
Section titled “When there is no line-by-line view”Some pairs are listed and classified like any other but cannot be shown as lines. The content view then says why, in place of the differences:
| Reason | What it means |
|---|---|
| Binary data | At least one of the two files contains binary data. |
| Not valid UTF-8 text | At least one file cannot be read as lines. It may be text in another encoding, such as Latin-1 or Windows-1252. |
| Too large | One file is bigger than 4 MiB. |
| Too many lines | The two line counts multiplied are too many to compare together — currently more than 33,554,432. Two files of 5,792 lines each are the largest equal pair that fits; a long file against a short one can still be compared. |
| Not an ordinary file | The entry on one side is a folder or a link, so there is no content to compare. |
These limits apply only to the line-by-line view. A binary file, or one that is too large, is still marked Same contents or Different in the overview by size and checksum — saying that two binaries differ is useful, so macSCP does.
Closing
Section titled “Closing”Closing the window stops a comparison that is still running and removes the temporary files it fetched. If the tab the comparison belongs to is closed first, the window stays readable but says so: the result is still there, and the contents of files can no longer be fetched.
A comparison is between two places in one tab. Comparing a folder on one server with a folder on another server is not available, and neither is editing either side from the comparison or handing the pair to another program.