     deleteFile: (doc, callback) =>
         log.info "Delete file #{doc._id}"
         return callback() unless doc.remote
-        @couch.remove doc.remote._id, doc.remote._rev, (err, removed) =>
+        remoteDoc = @createRemoteDoc doc, doc.remote
+        remoteDoc._deleted = true
+        @couch.put remoteDoc, (err, removed) =>
             if err
                 callback err, removed
             else

    deleteFolder: (doc, callback) =>
        log.info "Delete folder #{doc._id}"
        if doc.remote
            @couch.remove doc.remote._id, doc.remote._rev, callback
        else
            callback()


        if remote
            doc._id = remote._id
            doc._rev = remote._rev
            if remote.binary
                doc.binary =
                    file:
                        id:  remote.binary._id
                        rev: remote.binary._rev
        doc._id ?= Couch.newId()
        return doc

