Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get the file-extension?

0 views
Skip to first unread message

Schottito

unread,
Nov 5, 2003, 6:48:32 AM11/5/03
to
Hi,
Would like to query the extension of a file.
The result/return should looking like this "doc, txt, avi".
Is there a Xtra or a special kind of script I can use?
Thanks for your help.

Nathan Friesen

unread,
Nov 5, 2003, 9:47:56 AM11/5/03
to
Do you have the filename, or the full path to the file? If you do, you should be able to change the itemDelimiter to "." and get the last item in the string, which would be the file extension. It would be something like this:

myFile = <the file name/path>
tempDelimiter = the itemDelimiter -- store the old itemDelimiter
the itemDelimiter = "."
lastItem = myFile.item.count -- get how many items there are
myExtension = myFile.item[lastItem] -- get the extension
the itemDelimiter = tempDelimiter -- restore the itemDelmiter

Let me know if this is along the lines of what you were looking for.

Nathan

0 new messages