On Wed, Aug 7, 2013 at 1:47 PM, Michael B. Smith <mich...@smithcons.com> wrote:
> Psdrive is similar to, but not the same, as subst.
>
> The behavior you experience is exactly what should be happening.
>
> What are you trying to do?

Mostly what I want to do is map a drive letter to a path; read files
from that path; compare the list of files from 2 locations, to see
where the discrepancies are.

What I did was map a drive before starting the script. Then the script
reads files from a location. I modify the filepath to change the drive
letter to the mapped drive letter, and check for the existence of the
file at the mapped location.

So I have:

C:\web01\a\file1
C::\web01\b\file1

and I then manipulate the filelisting, and look for:

w:\web01\a\file1
w:\web01\b\file1

and report discrepancies. (eventually, I will synchronize them, by
copying missing files from C: to W:. And, if any such exist, the other
way. A sort of 2 way sync.


So if I read "C;\web01\a\file1" from a directory listing, I do a
little manipulation -  $DesiredFile=$filename.Replace($Web01_Drive,
$Web02_Drive), which replaces "c:" with "w:" - and then test-path for
$DesiredFile.

Figured that would be (literally) "quick and dirty". :-)

But that only works if the only difference in filepaths is the drive
letter. Which is what happens is I use SUBST or MAP, but not if I use
PSDrive. That means I have to verify that the SUBST or MAP step is
done, before the script starts processing. If I could get PSDrive (or
another command) to give me the same effect, I won't have to have code
to check that it was done first; I would just do it at the start of
the script, and remove it at the end of the script.


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to