Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions fns_cli/file_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,12 @@ def _collect_local_files(self) -> list[dict]:

def _try_remove_empty_parent(self, file_path: Path) -> None:
parent = file_path.parent
try:
if parent != self.vault_path and parent.exists() and not any(parent.iterdir()):
parent.rmdir()
except OSError:
pass
while parent != self.vault_path:
try:
if parent.exists() and not any(parent.iterdir()):
parent.rmdir()
else:
break
except OSError:
break
parent = parent.parent
14 changes: 9 additions & 5 deletions fns_cli/note_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,15 @@ def _check_all_received(self) -> None:

def _try_remove_empty_parent(self, file_path: Path) -> None:
parent = file_path.parent
try:
if parent != self.vault_path and parent.exists() and not any(parent.iterdir()):
parent.rmdir()
except OSError:
pass
while parent != self.vault_path:
try:
if parent.exists() and not any(parent.iterdir()):
parent.rmdir()
else:
break
except OSError:
break
parent = parent.parent

def _collect_local_notes(self) -> list[dict]:
notes = []
Expand Down
Loading