Using File.list()

Hi,
Im using FMS 3 on the server side when onConnect occures i
need an array of all file that is the directory root/streams/myApp
how do use the File.list() ? do i need to create a new file
just for getting the list of files of the directory? and how do i
get to do that on the directory i want ? is it like this:
File.list(function(name){ return
name.indexOf("streams/myApp/")!=-1);
i so the example in the doc files :
var a = x.currentDir.list(function(name){return
name.length==3;});
does x is a File object? and where the currentDir came from
its not a File property?
Please help ...

In SSAS, File objects represent both files and directories.
The "x" in the examples just means "arbitrary thing that has
a member of whatever type we're talking about." In this case, "x"
is something that has a member called "currentDir" that's a File
object (presumably representing the current directory).
I'm pretty sure you can create an equivalent like this:
currentDir = File(".");
Also, your search isn't going to work the way you expected.
The find function doesn't search all subfolders recursively, and
the name parameter only gets the filename (the last component of
the path), not the entire pathname. You're going to want to open
streams/myApp as a File, then just list everything in it.

Similar Messages

  • How to return only filename without extention using File.list() ?

    I want to return every filename into an array using File.list() However I want my return String array to be filtered out file extention. That means only return file name without extention. How? Please advice! Thanks.

    Use the following method for every file in the list (it's from the top of my head so maybe there are a few typos):
    private String getNameWithoutExtension(File f) {
        String s = f.getName();
        String name = s;
        int i = s.lastIndexOf('.');
        if (i > 0 &&  i < s.length() - 1) {
            name = s.substring(1, i);
        return name;
    }

  • OutOfMemoryError while using File.list()

    I'm facing OutOfMemoryError while using file.list(). Below is the description of the requirement
    We have a directory structure of the following format -
    **sourcedir\<date folders>\No Retry\<reason folders>\..\..\....\<*.ini files>**
    sourcedir will be passed as argument to the program. The directories present in between "<>" can be in multiples of 10. The *.ini files can be in multiple of lacs in each directory.
    The program is required to browse through the directory structure and look for *.ini files. The *.ini files are parsed for some data which needs to be stored in data base. We are using "File.list()" to load the name of files and FileFilter to find *.ini" files. As the number of files are huge the program is throwing OutOfMemoryError. We have increased heap space, it solved the problem. But we are looking for a solution which will not throw this error in future as the number of files may increase.
    Can you please suggest us a technique to solve this permanently as we are beginners to java.

    I suggest you try using a memory profiler to see where your memory is being used.
    The problem you suggest shouldn't consume so much memory.

  • Most Recent Used File List

    Hi,
    Does anyone know how to create List of most recent used files and display it in the main menu?
    Has anyone done that?
    Currently, I am opening one file at the time and I have the last
    path of opened file.
    thanx !

    You could recurse over the file system, creating a bunch of File objects, which you'd stick into a List. Then create a comparator that sorts the objects by File.lastModified() value, descending.
    Then you'd have a sorted list, from which you could easily take the N most recent files.
    Of course, the recursing would take a while. You may want to put creation and/or updating of this list, into a low priority thread.

  • Most Recent Used File List in Menus

    Hi,
    Does anyone know how to create List of most recent used files and display it in the main menu?
    Has anyone done that?
    Currently, I am opening one file at the time and I have the last
    path of opened file.
    thanx !

    Offhand, you'll have to do it the hard way. I don't think Swing or Awt provide a default JMenuItem(), MenuItem() that does the file list. Now that you mention it, it does seem like an interesting project to do.
    You essentially need an array of the files, and for each file, create the associated menu entry, as in:
    String entryName = files[ i ];
    if ( entryName.length > 10 ) {
       entryName = entryName.subString( 0, 10 );
    JMenuItem entry = new JMenuItem( i + ". " + entryName );
    ...and define the event listeners however appropriate for your application.

  • How do I edit the Screen Sharing 'Most Recently Used' files list ?

    I have recently added a mac mini to the network at home, and will be using this as a headless device. I am connecting remotely (using screen sharing) which works well. I have set the Sceeen Sharing icon to remain permanently visible on the dock, ad by right clicking, I get a list of the most recently used shares.
    The trouble is, that some of theses shares no longer exist, and tghere is also some duplication.
    I would like to edit this list, but cannot find out how to do it.
    Can anyone help please ?
    Thanks
    Geoff
    PS - The same principle applies to a number of other programs that retaim n MRU lst on their dock icon - how can these be edited.

    This doesn't apply to me anymore.

  • Last used files of an appilcation in start screen

    Hello,
    I don't know if someone from Microsoft is reading this (I hope so) but I really would like to see a feature that shows the recent used files of an application in the start screen.
    I don't have that much problems with that start screen in general. But this is one of the features I miss when using the new start screen introduced with Windows 8. Just to be clear.
    I am asking for a feature which shows the last opened files of an application listed in the start screen. You can see this feature at the start menu in Windows 7 - this tiny black arrow right of an application. For example an arrow right of Microsoft Office
    Word which shows the last opened documents of Office Word.
    It could be implemented as a context menu sub-menu. But I guess you have got the better designers for fitting this feature somewhere (?).
    This feature is very important for me. This is the only reason I don't like the new start screen that much because I like the recent used file list of one specific application.

    On Tue, 25 Nov 2014 00:15:31 +0000, Markus Schuhmacher wrote:
    I don't know if someone from Microsoft is reading this (I hope so) but I really would like to see a feature that shows the recent used files of an application in the start screen.
    If you really want someone from Microsoft to see this suggestion then you
    need to file it using the feedback app.
    Paul Adare - FIM CM MVP
    We're standing there pounding a dead parrot on the counter, and the mgt.
    response is to frantically swap in new counters to see if that fixes the
    problem. -- Peter Gutmann

  • Removing Recent File List in Staroffice 7?

    I have been asked by a user to remove the Recently used file list in Staroffice 7. I cannot seem to find where this information is stored or a built in option to Clear the List
    Any Deas?
    Thanks

    Spot on Phil. I was looking for the wrong extension.
    I have now Created a Batch file to be run as and when to remove the file and my user seems happy with that.
    Thanks
    Michael
    Batch File Command used
    c:
    cd\
    cd C:\Program Files\StarOffice7\user\registry\
    del data\org\openoffice\Office\common.xcu /s

  • How to use dynamic file as welcome-file-list in web.xml

    I have configured my web.xml file as this,
    <web-app>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>login.jsf</welcome-file>
    </welcome-file-list>
    </web-app>
    and my login.xhtml file as this,
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core">
    <body>
    <f:view>
    <h:form>
    UserName:<h:inputText id="userName"
    value="#{bean.userName}" rendered="true"
    required="true"/>
    Password:<h:inputText id="password"
    value="#{bean.password}" rendered="true"
    required="true"/>
    <h:commandButton id="submit" value="Submit" action="#{bean.authenticate}" />
    </h:form>
    </f:view>
    </body>
    </html>
    but when i deploy this using tomcat and try to put url as this,
    http://localhost:8080/project
    Its not identifying welcome file from web.xml
    I am getting error like this,
    The requested resource (/project/) is not available.
    How to resolve this,
    Thanks,
    Vinutha

    This might help:
    http://forum.java.sun.com/thread.jspa?threadID=696586
    As well, you might have to change the servlet-mapping in your web.xml. The url-pattern, I think, needs to be .xhtml. Your login.jsf file in the welcome list will need to be renamed to login.xhtml.
    CowKing

  • After successful install, I am unable to use RoboHelp 7 because of constant refresh of file lists

    RoboHELP 7 installed on Windows XP
    Our enterprise support team installed RH7 on my new laptop via our corporate intranet.  I received an e-mail message reporting that the install failed so I contacted the support team, someone logged on to my machine by remote and did an uninstall of RH7.  Then, the install was done again and the same failure message was received.  Then, RH was uninstalled and the install was attempted for the third time.  Again, I received the failure message.  I had noticed that after each install the icons appeared on my desktop.  So, after this third install, I went ahead and clicked the RH7 HTML icon and the program seemed to start properly.  I have a key number from our enterprise team and I entered the key number to complete the registration.  The UI appeared and I selected my recent project.  RH built the file lists that I expected to see in the left panes of the interface but the file lists kept "twitching" and the cursor kept changing to the hourglass and back.  This happened about once every two or three seconds and I could not move my cursor fast enough to select a file.
    One of my co-workers suggested that I uninstall RH7 myself, check the registry and erase any robohelp entries.  I know this is risky but I am confident I can do it.  However, I would like to hear from any RH experts about how to solve this "twitching" problem, if there are other possible solutions.  Thanks.

    My gut feel is that if your organisation is large enough to have an Enterprise license, IT would not take too kindly to you uninstalling the product yourself and editing the registry. That's your issue though.
    If they are happy, then you could try www.revouninstaller.com with which a number of people have reported good results if you use the stronger options to clear the registry. Again at your risk and responsibility.
    You might also like to look at http://www.adobe.com/devnet/robohelp/articles/before_install.html. It includes the script IT should be using. Maybe that should be checked as well.
    The other approach is to get them to do a direct install. Worth trying given the issues you are having.
    See www.grainge.org for RoboHelp and Authoring tips

  • List files using file adapter in 10G

    Hi',
    How can we list the files using File/FTP adapter in SOA 10G.
    My requirement is to get details like name of file and the timestamp.
    Please advice.
    Thanks
    Yatan

    Yatan,
    I used in the past a javaEmbedded activity which uses a shell script to list and get all the needed data from a directory.
    (I found it the easiest and faster way to do it)
    Arik

  • Can't tab into file list when using column view in the open/save dialogue boxes

    Hi,
    When in Open/Save Dialog Boxes I can't use tab to select the file/folder list in Column View. Tab will only cycle through Save As, Tags, Search, and the Sidebar. In all the other views (Icon, List, Cover) I can tab into the file list. Is this a bug?
    I know that enabling Full Keyboard Access will make this work, but I'd rather not do that since it increases the number of buttons you must tab through to get to the file list.
    I'm using the latest version of Yosemite on a 2014 Macbook Air. Thanks.

    Hi,
    Did you found the solution to this? I'm also trying to do something like you , but I got stuck up in a very primitive stage than you. I'm not getting how I can make that File Download window to appear. Can you help me please.
    Thanks.

  • List contents of Directory using File Object.

    Hi. I am new to Java.
    Right now I want to list the contents of a specific directory. One approach is to use FILE array. But I just cannot get it right. Am i missing out something?

    Thanks.
    My idea was to retrieve the contents of directory and then when the form loads; the contents of directory (only directorys, not files; hence i think i can use isDirectory to check) will be loaded into a listbox (DefaultListModal i supposed)
    I ran it without any errors. The Listbox is loaded; but then the listbox reads
    Java.lang.String;@1a7508a
    What went wrong?

  • Using the array of file names from File.list()

    Hi
    I'm having trouble with my code, similar to this:
    File temp=new File(path); //where 'path' is a String containing the directory path
    String [ ] arr = temp.list();
    Then when trying to use arr, I come up with NullPointerExceptions.
    The Java API says that the File.list() method returns a Stirng array.
    But then how do I use/get this array in a nice usable form?
    (eg. to be able to loop through the list of {returned} Files)

    Yes I have referred closely to the documentation.
    The method list() for my File object is definitely not returning null;
    it seems that as soon as the code inside the loop tries to access the next element of the returned array [the one after the last existing element] - which is actually non-existent (ie overstepped the bounds of the array's index) - the program comes up with an Exception*. So the method list() does not return null...
    I have managed a workaround similar to this:
            File temp = new File (path);
            String[] list = new String [temp.list ().length + 1];
            try
                for (int i = 0 ; temp.list () != null ; i++)
    list [i] = temp.list () [i];
    catch (ArrayIndexOutOfBoundsException iobe)
    * The program is not coming up with NullPointerExceptions anymore; only an ArrayIndexOutOfBoundsException if I comment out the try and catch coding.... (?)
    Thanks for your suggestion about posting this at the Java Programming Forum.
    My workaround works, but is there a way to do this without catching an exception?

  • Computer Contents in File List

    My file list now contains all of the items and files in my
    computer, including all materials on my back-up hard drive and the
    network. How do I delete this from the file list.

    That's normal- it belongs there. ignore it or use when it's
    handy.
    It's use is to find and copy files that are outside of the
    Local site folder
    while staying inside of dreamweaver.
    If it wasn't there- you'd have to go to the Desktop or My
    Computer, browse
    to the file, copy it, browse to the Local Site Folder, paste,
    then go back
    into dreamweaver.
    suggestion- go to the Help menu-->Using
    Dreamweaver-->the dreamweaver
    workspace or similar wording.
    > I am new to Dreamweaver 8 but there is s drop down menu
    under file. The drop
    > down is titled computer and when the drop down is open
    my options are
    > Macintosh
    > HD, PSP5000 (which is my back-up drive) and network.
    Separated by a line is
    > manage sites. Does this help?
    >

Maybe you are looking for

  • Problem in AR Line Item IDOC method

    Hello Guys , iam migrating open AR Line Items using lsmw Idoc method.when i uploaded the flat file and converted the file .at step 10 display converted data it is not displaying the values for the field  net duedate(FAEDN) and amount(BETRW)  but when

  • How to find the version of oem

    How to find the version of the installed oem? I have /home/oracle/10.1.0/oem But I wanted to know the the last digit as well thanks

  • Need newer bios for sr1710nx

    hi I have a hp compaq presario sr1710nx I am runing bios for the hp site (01/25/2007 rs482-sb400 amberine-00) i need to find a newer bios becouse fo video probloms can any one help ?

  • FCP studio 2: FCP not working "may be damaged or incomplete"

    Hi, First of all i would like to say that I have read fairly extensively in the forums under the following topics: "you can't open the application final cut pro because it may be damaged or incomplete" and "Final Cut Studio 2 installation hangs under

  • Infotype 0002 - personel data

    Hi All While Creating a IT 0002 , the field  "Gender"  is showing the default value as  "Unknown"  . Now i want to set this field with the default value as  "Male" Please let me know the solution . I would appreciate for an earliest response . Thanks