Skip to content

Commit

Permalink
less confusing is_empty_directory implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
erietz committed Jul 24, 2023
1 parent 7d988fe commit 24911b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pisync/config/remote_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def is_symlink(self, path: str) -> bool:

def is_empty_directory(self, path: str) -> bool:
"""returns true if path is a directory and contains no files"""
return self.connection.run(f'test -n "$(find {path} -maxdepth 0 -empty)"', warn=True).ok
return self.connection.run(f'test -z "$(ls -A {path})"', warn=True).ok

def file_exists(self, path: str) -> bool:
"""returns true if the file or directory exists"""
Expand Down

0 comments on commit 24911b7

Please sign in to comment.