diff --git a/invenio_utilities_tuw/cli/files.py b/invenio_utilities_tuw/cli/files.py
index a57870fde9cafd3139a9d6da4debd35bebd9c36a..ec902e87737515e89ad6ccff9a943f1575928daa 100644
--- a/invenio_utilities_tuw/cli/files.py
+++ b/invenio_utilities_tuw/cli/files.py
@@ -50,7 +50,7 @@ def get_orphaned_files(location):
     # filter out those files that invenio has knowledge about
     for bucket in location.buckets:
         for obj in bucket.objects:
-            if obj.file:
+            if obj.file and obj.file.uri in all_files:
                 # an object_version without attached file_instance
                 # likely denotes a soft-deleted file
                 all_files.remove(obj.file.uri)