Fix error in finding artifact directory name when one already exists

Ticket: 0
Reviewed By: none
Testing Done: ran infra tests