Checking media count before deleting file