Jump to content

Recommended Posts

Posted (edited)

Hello again everyone, I have another issue I was hoping someone could point out what I did wrong because I have no clue at this point. The part that is giving me trouble is just a FileCopy command but it says it cannot find the path. My only speculation is that the path is to long but I don't know. Here is what I have an it works.

*Note: I had to do some sanitizing so it's not word for word but still should work. Also, I've been using msgbox to verify that the path being used is what I expect it to be.

Case $msg = $CheckListSetup
        $ServerName = InputBox("Server Name", "What is the name of your server?")
        $Location = StringLeft($ServerName, 3)
        MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)
        if $Location = "aaa" Then
           FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)

And when I go one folder deeper it stops working:

Case $msg = $CheckListSetup
        $ServerName = InputBox("Server Name", "What is the name of your server?")
        $Location = StringLeft($ServerName, 3)
        MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)
        if $Location = "aaa" Then
           FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH)

Thank you for your time.

Edited by cdjphoenix
Posted

Have you tried the beta version of AutoIt? Can you copy with the cp command?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

I've always had really weird problems noone could explain to me while using UNC-Paths with AutoIt.

I'd suggest you try to map the path to a certain drive letter first, this usually solves all UNC mysteries. :)

Edited by Radiance
Posted

Sorry for the delay in responding, go sick over the weekend. I will test both your theories and let you know what happens. I did notice something as I was playing around with it yesterday though. While it does not seem to be able to create the new folder it still seems like it will create the new file despite the error.

Posted (edited)

have you tried using filegetshortname?

like:

$path = "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds"
$file = "Windows Server Build Checklist.dotm"

filecopy(filegetshortname(@ScriptDir & "\" & $file) , filegetshortname($path & "\" & $file))
Edited by boththose

  Reveal hidden contents

  • Solution
Posted

I found the issue, it turned out to be a piece of code a little farther down. I couldn't tell because the path was so long it truncated the useful info.

Posted
  On 3/18/2015 at 5:31 PM, cdjphoenix said:

I found the issue, it turned out to be a piece of code a little farther down. I couldn't tell because the path was so long it truncated the useful info.

Aha!

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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