Extracted the logic to find uploaded files

Will be reused in the sftp server