Back to Kikoff questions
CodingSoftware Engineer

One-Way Synchronized Filesystem

Frequency: Reported


Build a simplified Dropbox-style filesystem for two computers. Each computer has a local filesystem. Every change made on computer 1 must automatically be reflected on computer 2; synchronization is one-way, so changes on computer 2 do not propagate back.

Implement FileSystem with:

text
create_folder(path: str)
  • Overwrite any file or folder already at path.
  • Folders must be created explicitly; do not create missing parent folders implicitly.
text
create_file(path: str, content: str)
  • Overwrite any file or folder already at path.
text
move(src_path: str, dest_path: str)
  • Move a file or an entire folder recursively.
text
delete(path: str)
  • Delete a file or an entire folder recursively.
text
get(path: str) -> str
  • File: return "file: {content}".
  • Folder: return "folder".
  • Missing path: return "not found".

Assume Unix-style paths such as /a/b/file.txt, and assume every file name has an extension such as .txt or .py.

The preserved source includes the synchronization scaffold, a submitted C++ attempt, and the full reported test suite. The attempt is incomplete and internally inconsistent in places, so it is evidence of the interface and attempted answer rather than a verified solution.

Starter scaffold, submitted C++ answer, and tests