Skip to content

Commit

Permalink
Delete only if it is a file
Browse files Browse the repository at this point in the history
  • Loading branch information
L2JE committed Nov 17, 2021
1 parent dba4f28 commit 48a71ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contents/winrm-filecopier.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def winrm_upload(self,
self.session.run_ps('if (!(Test-Path {0})) {{ New-Item -ItemType directory -Path {0} }}'.format(remote_path))

if(override):
self.session.run_ps('if ((Test-Path {0})) {{ rm {0} }}'.format(full_path))
self.session.run_ps('if ((Test-Path {0} -PathType Leaf)) {{ rm {0} }}'.format(full_path))

size = os.stat(local_path).st_size
with open(local_path, 'rb') as f:
Expand Down

0 comments on commit 48a71ee

Please sign in to comment.