Jump to content

DriveMapAdd and FileCopy on Remote Drive


omac12
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 ?

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...