Add retry when delete remote folder status is 301

some time delete remote folder , server will return 301 and a new location.
example:
Request: DELETE http://host/some/folder
Response: status 301, location=http://host/some/folder/