Link to home
Start Free TrialLog in
Avatar of itnifl
itniflFlag for Norway

asked on

Copy-Item, Move-Item, Test-Path and locking the file until complete

I am using the cmd'lets Copy-Item and Move-Item to move or copy files from one location to another. I then use Test-Path  to verify that the file has arrived. But sometimes there is another system on the receiving end that moves the files to yet another location before the Test-Path cmd-lets gets time to verify.

Is there any way to lock the file until Test-Path has done it's job? Or in any way ensure that the any other system does not move the files before Test-Path has run?
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itnifl

ASKER

Yes offcourse!
And I was thinking of creating a new cmd-let  or function that would use system.io in .Net and lock the file until verified on the other side. Glad I don't have to :)