Sign in to follow this  
Followers 0
MadSc13ntist

FileExists over a share?

8 posts in this topic

Is there a way to get (accurately) the status of a file over a network drive WITHOUT MAPPING?

I have a script that deploys files to a network share on the remote C drive... i.e.

Run('cmd /c NET USE \\' & $ip & '\C$ "' & $pass & '" /USER:"' & $user & '", '', @SW_HIDE)

then i copy it over:

Run('cmd /c COPY /Y "' & $filepath & '" "\\' & $ip & '\C$\' & $filename & '", '', @SW_HIDE)

Now i want to be able to (reliably) know if the file exists WITHOUT mapping the drive i.e.

NET USE z: \\10.1.6.75\C$ "admin" /USER:"Administrator"

the reason being that disconnecting the drive seems to lag on this machine sometimes, and that slows to deployment down a great deal....

Any other remote deployment guys out there that have tackled this one?

Share this post


Link to post
Share on other sites



Someone's going to get flamed for this one =\


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

Someone's going to get flamed for this one =\

<{POST_SNAPBACK}>

For the first post, or the half dozen others that said the same thing?

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

i think his internet just hang. i had that also, but then with a post not a topic


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is there a way to get (accurately) the status of a file over a network drive WITHOUT MAPPING?

I have a script that deploys files to a network share on the remote C drive... i.e.

then i copy it over:

Now i want to be able to (reliably) know if the file exists WITHOUT mapping the drive i.e.

the reason being that disconnecting the drive seems to lag on this machine sometimes, and that slows to deployment down a great deal....

Any other remote deployment guys out there that have tackled this one?

<{POST_SNAPBACK}>

Why use the NET command when you can do the same thing with a built-in function?

This works for me:

If DriveMapAdd("", "\\192.168.0.1\c$", 0, "administrator", "password") Then
    If FileExists("\\192.168.0.1\c$\autoit-v3.1.0.exe") Then
        MsgBox(0, "", "File Found!")
    ;;; Do your copy here!!!
    Else
        MsgBox(0, "", "File NOT Found!")
    ;;; Handle your file not found here
    EndIf
    DriveMapDel("\\192.168.0.1\c$")
EndIf
Edited by pacman

Share this post


Link to post
Share on other sites

didn't he said not to connect the map??

and can't u use net view \\.... to see??


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

didn't he said not to connect the map??

and can't u use net view \\.... to see??

<{POST_SNAPBACK}>

He did say that but he was also using

Run('cmd /c NET USE \\' & $ip & '\C$ "' & $pass & '" /USER:"' & $user & '", '', @SW_HIDE)

in his script.

You can't check for a file or copy files to a remote share without first connecting to it. You can't use NET VIEW to check for a file on a remote share either.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok this is interesting.....

When i map the drive via the NET USE z: method... hang-city....

When i use the Function, it screams through the code like i wanted it to...

wtf? I didn't know about that function, but it makes me wonder what is different about how Au3 handles it that makes the difference...

where is the hang? is it because the cmd /c is used? does this slow the execution of that line so much more than the function?

Props for the DriveMapAdd/DriveMapDel referance this has helped me out alot.

(I still wish i knew what was lagging it so much... :lmao: )

Props to everyone who responded, i know this sounds bad but i swear it's not devious in nature. just being lazy and was curious about the lag....

Edited by MadSc13ntist

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0