Sign in to follow this  
Followers 0
omac12

DriveMapAdd and FileCopy on Remote Drive

4 posts in this topic

Hello, my first post and first day trying out AutoIt. I am writing a script (or trying to) that will map 2 network drives and copy a file from those drives then go to a subdirectory on those drives to paste, rename the file, then copy the renamed file to the computer that will run the script. Basically, it looks like this so far.

Dim $varDate

Dim $varModDate

$varDate = _NowDate()

$varModDate = stringreplace($varDate,"/","-",0)

$myFileName = "newfile" & $varModDate

$myFileName2 = "newfile2" & $varModDate

; Map P drive to \\firstdrive\mydir using current user

DriveMapAdd("P:", "\\firstdrive\mydir")

FileCopy("P:\firstdrive\thisfile.txt, "P:\mydir\old\$myFileName")

; Map Q drive to \\seconddrive\mydir using current user

DriveMapAdd("Q:", "\\seconddrive\mydir")

FileCopy("Q:\seconddrive\thisfile.txt, "Q:\mydir\old\$myFileName")

DriveMapDel( "P:" )

DriveMapDel( "Q:" )

I couldn't use the date format with forward slashes in my file name so I changed them to dashes. My problem seems to be either, my drive mapping is taking too long (it seems to under Windows 2000 explorer also), or I can't execute the FileCopy function on the remote drive. What am I doing wrong? Please help.

Al

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your DriveMap commends look confusing: DriveMapAdd("P:", \\firstdrive\mydir) isn't that :

DriveMapAdd("P:", \\Servername\Sharename) ?

This also doesn't look right : FileCopy("P:\firstdrive\thisfile.txt, "P:\mydir\old\$myFileName")

Shoud be: FileCopy("P:\firstdrive\thisfile.txt, "P:\mydir\old\" & $myFileName)

Are you also sure about the source directory ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank you for your reply. Firstly, those aren't the actual names. I work at a casino that encourages us not to use actual sharenames whenever something isn't internal. The servername and sharename were \\firstdrive\mydir. What looks confusing about the second is I wanted to save to a subdirectory of that share. I tried the change to the filecopy syntax, and it errored out as well.

Al

Your DriveMap commends look confusing: DriveMapAdd("P:", \\firstdrive\mydir) isn't that :

DriveMapAdd("P:", \\Servername\Sharename) ?

This also doesn't look right : FileCopy("P:\firstdrive\thisfile.txt, "P:\mydir\old\$myFileName")

Shoud be: FileCopy("P:\firstdrive\thisfile.txt, "P:\mydir\old\" & $myFileName)

Are you also sure about the source directory ?

Share this post


Link to post
Share on other sites

Thank you for your reply. Firstly, those aren't the actual names. I work at a casino that encourages us not to use actual sharenames whenever something isn't internal. The servername and sharename were \\firstdrive\mydir. What looks confusing about the second is I wanted to save to a subdirectory of that share. I tried the change to the filecopy syntax, and it errored out as well.

Al

I've just found that this has to be done right now so I am going to do a very quick vb program. Thank you for your help.

Al

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