Skip to content

Relative Path

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
  • jchapman01 Offline
  • Posts: 6
  • Joined: Fri Dec 02, 2016 3:05 pm

Relative Path

Post by jchapman01 »

I have a move command that takes in a variable for the source file. I was hoping to set the destination folder to be relative to that file. If there anyway to do that?

Thanks.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Relative Path

Post by Support_Rick »

Do a search on your help for "local file attributes".

Review how to retrieve the "parentFile". This will give you just the path to the file. Then adjust accordingly...
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • jchapman01 Offline
  • Posts: 6
  • Joined: Fri Dec 02, 2016 3:05 pm

Re: Relative Path

Post by jchapman01 »

So I found the one example located here:

how-to-use-file-attributes-at-325

I copied that example out. However if I assign to a variable like

<variable name="File" value="resource:smb://SomeDirectory/SomeFile.txt" />
<variable name="FileDirectory" value="${ FileInfo( File):parentFile }" />

The output from ${ FileDirectory} is "${ FileInfo( File):parentFile }" and NOT "resource:smb://SomeDirectory".

Ideas?
  • jchapman01 Offline
  • Posts: 6
  • Joined: Fri Dec 02, 2016 3:05 pm

Re: Relative Path

Post by jchapman01 »

So I found the one example located here:

how-to-use-file-attributes-at-325

I copied that example out. However if I assign to a variable like

<variable name="File" value="resource:smb://SomeDirectory/SomeFile.txt" />
<variable name="FileDirectory" value="${ FileInfo( File):parentFile }" />

The output from ${ FileDirectory} is "${ FileInfo( File):parentFile }" and NOT "resource:smb://SomeDirectory".

Ideas?
  • jchapman01 Offline
  • Posts: 6
  • Joined: Fri Dec 02, 2016 3:05 pm

Re: Relative Path

Post by jchapman01 »

So I found the "Set Variable" task and that worked. Apparently the example in the one post was not quite correct.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: Relative Path

Post by Support_Rick »

The HELP text shows you 2 examples for the FileInfo Function:

Examples
${FileInfo("C:\example.txt"):exists} - Returns true or false indicating whether or not the file exists.
${FileInfo("resource:smb://resourceName/file.txt"):size} - Returns the file size of the specified file in a Network Shares resource.

Keep in mind that the parameter has to be a "STRING" value.

Try this:

<variable name="File" value="resource:smb://SomeDirectory/SomeFile.txt" />
<variable name="FileDirectory" value="${ FileInfo( String( File ) ):parentFile }" />
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Post Reply