Home > Community > Forums > PCB SKILL > Getting file name from a port

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Getting file name from a port 

Last post Sun, Oct 7 2012 7:13 PM by Pawandeep. 3 replies.
Started by Pawandeep 07 Oct 2012 06:57 PM. Topic has 3 replies and 911 views
Page 1 of 1 (4 items)
Sort Posts:
  • Sun, Oct 7 2012 6:57 PM

    • Pawandeep
    • Top 75 Contributor
    • Joined on Sat, Oct 15 2011
    • Singapore, 00-SG
    • Posts 106
    • Points 1,690
    Getting file name from a port Reply
    Hi,

    Is there any function for getting the file name of a port?

    Say if I want to get the “test.xls” from the below port.

    inPort = infile(“C:\test\test.xls”)

    Thanks,

    Pawan
    • Post Points: 35
  • Sun, Oct 7 2012 7:03 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 750
    • Points 16,220
    Re: Getting file name from a port Reply
    get_filename(inPort)
    Dave Elder, Tait Communications
    • Post Points: 5
  • Sun, Oct 7 2012 7:04 PM

    • Tyler
    • Top 500 Contributor
    • Joined on Thu, Jul 17 2008
    • Tempe, AZ
    • Posts 35
    • Points 520
    Re: Getting file name from a port Reply

    You can use get_filename(<port>) to get the full path for the port as a string. This can be passed to axlDMFileParts() to get the different portions, such as the directory, file name, file name with extension, or just file extension. Since you seem to want the file with extension, you would want the third element in the list returned from axlDMFileParts().  

    Regards,
    - Tyler 

    • Post Points: 20
  • Sun, Oct 7 2012 7:13 PM

    • Pawandeep
    • Top 75 Contributor
    • Joined on Sat, Oct 15 2011
    • Singapore, 00-SG
    • Posts 106
    • Points 1,690
    RE: Getting file name from a port Reply
    Hi Tyler/Dave,

    Below works very well.

    axlDMFileParts(get_filename(inPort))

    Thanks,

    Pawan
    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by Pawandeep at 07 Oct 2012 06:57 PM. Topic has 3 replies.