Relative Path

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
6 posts Page 1 of 1

jchapman01

Posts: 6
Joined: Fri Dec 02, 2016 3:05 pm

Post by jchapman01 » Mon Dec 05, 2016 9:56 am
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

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Dec 05, 2016 10:04 am
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

Posts: 6
Joined: Fri Dec 02, 2016 3:05 pm

Post by jchapman01 » Mon Dec 05, 2016 11:30 am
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

Posts: 6
Joined: Fri Dec 02, 2016 3:05 pm

Post by jchapman01 » Mon Dec 05, 2016 11:44 am
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

Posts: 6
Joined: Fri Dec 02, 2016 3:05 pm

Post by jchapman01 » Mon Dec 05, 2016 12:06 pm
So I found the "Set Variable" task and that worked. Apparently the example in the one post was not quite correct.

Support_Rick

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Dec 05, 2016 12:09 pm
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
6 posts Page 1 of 1