How to get a directory listing in XE?

So how would you best get a directory listing?
There was a lovely thread about using dbms_scheduler to make external calls:
Re: External procedure calls supported?
Which discussed how to run an external prcoedure. So using that technique would an approach be:
create procedure get_dir(p_dir varchar2)
--get sequence for directory call
--call 'synronous dbms_scheduler that executes "ls -l > /tmp/listing[sequence]
--create external table temp_dir_[sequence]
--load it into a global temp table ala ASKTOM http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584
--drop the external table
Someone on Asktom said they were going to do it via dbms_pipe but was not forthcoming with an example.
I'm not sure I like creating and dropping an external table every time this procedure is called and I feel I am missing a technique (or a good idea) to make this work effectively.
Kind Regards,
James
Got the link to the 'External procedure calls support' wrong.
Message was edited by: jcrockart

Ok.
Well here is the solution... Can I make it better?
FROM OS (oracle user):
vi ~/get_dir.sh
#!/bin/sh
ls $1 > /tmp/$2
exit 0
##end
FROM SYS:
create directory OS_TMP as '/tmp';
grant read,write on directory OS_TMP to hr;
grant create table to hr;
FROM HR:
create global temporary table DIR_LIST
( filename varchar2(255) )
on commit delete rows
--create the following:
CREATE OR REPLACE procedure get_dir_list (
p_directory     in varchar2
IS
l_jobname VARCHAR2 (100);
BEGIN
     l_jobname := DBMS_SCHEDULER.generate_job_name (prefix => 'get_dir_list');
     dbms_output.put_line(l_jobname);
     --dbms_output.put_line('ls '||p_directory||' > /tmp/blah');
     --creat syncrhous job
     DBMS_SCHEDULER.create_job (
          job_name => l_jobname,
          job_type => 'EXECUTABLE',
          job_action => '/home/oracle/get_dir.sh',
          number_of_arguments => 2,
          enabled => FALSE,
          comments => 'directory listing for '||p_directory);
     DBMS_SCHEDULER.set_job_argument_value (l_jobname, 1, p_directory);
     DBMS_SCHEDULER.set_job_argument_value (l_jobname, 2, l_jobname);
     -- Run job synchronously.
     DBMS_SCHEDULER.run_job (job_name => l_jobname, use_current_session => TRUE);
     -- Remove job after run
     DBMS_SCHEDULER.drop_job (l_jobname);
     --create external table
     execute immediate '
          create table '||l_jobname||'_ext
          file_name               varchar2(1000)
          organization external (
          type          oracle_loader
          default     directory os_tmp
          access parameters (
               records delimited by newline
               fields terminated by '',''
               missing field values are null
               file_name)
          location ('''||l_jobname||''')
          reject limit unlimited';
          execute immediate '
          INSERT INTO DIR_LIST(FILENAME) select file_name from '||l_jobname||'_ext
END;
--test it
exec get_dir_list('/home/oracle')
GET_DIR_LIST14
PL/SQL procedure successfully completed.
hr>select * from dir_list;
FILENAME
apex
apex_3.0.1.zip
get_dir.sh
go.log
go.txt
test.sh
6 rows selected.
hr>
Apologies for butchering Dietmar Aust dbms_schedule example.
I can't drop the external table as the data in the global temporary table will be lost, so I will have to periodically clean up after this procedure.
Please somebody feel free to give me the one line solution ;-)
Regards,
James

Similar Messages

  • How to get value from list item

    Hi all,
    How to get value from list item?
    I have a problem with the List Item object
    in the Oracle forms.
    How can I retrieve the selected item from
    a list ?
    I didn't find any function like 'list.GET_
    SELECTED_ITEM()'...
    thanks
    Bala

    Hello,
    You get the value as for any other Forms item:
    :value := :block.list_tem ;Francois

  • How to get Active users list in Essbase 6.5.6

    Hi Gurus,
    How to get Active users list in Essbase 6.5.6 version
    I dont find any Esscmd to find active users list....
    i used LISTLOGINS command in ESSCMD but its not helping me out....
    pls suggest me some approach to find active users list.
    Thanks in advance....

    Hi  ,
    Display sessions will give only active users details which are currently connected to the ESSBASE .
    if you need this list ? or  you need the  total list of   security  active users list ?
    if you need the currently connected to the ESSBASE
    if you check  one server  At a time  or you can check the application level also
    1)server level
    display  session all;
    2)application level
    display session on application  'application name ';
    go for the  run command ---> essmsh----->  login;----->enter user name ----> enter password----->enter host (like server name )  then you need to you   above  1 &2  commands
    Thanks,
    suresh

  • How to get the users list that can Add/Remove or modify Vendors in Oracle?

    How to get the users list that can Add/Remove or modify Vendors in Oracle?
    I need to generate a report like name and responsibility. Thanks

    That query gives the Supplier information.
    But what i would be needing is to find out the USERS in oracle who can Add/Modify or Remove Vendors.
    I assume it should be based on the Responsibility.

  • How to get Saved Selection list in javascript?

    Hello!
    Recently I met a little problem about save selection. I want to get saved selection list so that I can used in javascript. Now I have no ideals. Hope you tell me some useful information about how to get Saved Selection list in javascript!

    Mark is right, it's not possible.
    But do you know you can assign selection to a variable, and get back to it simply like this?
    var sel = app.selection;
    app.selection = null;
    /* your codes here
    app.selection = sel;

  • How to get page item list in  a page?

    how to get page item list in  a page?

    Have a look at ISpread::GetItemsOnPage().
    That should get you started.

  • Urgent: Want to get the directory listing

    Hi,
    My iAS and iWS reside on separate unix machines.
    My pdf files being a static content reside on iWS.
    My application which is deployed on iAS, wants to
    know the names of the pdf files residing on iWS.
    Can anyone tell me, as to whether there is any way
    for an application deployed on iAS to get the directory
    listing of files residing on a separate machine.
    Is there any API which will be of help ?.
    I guess there must be some APIs associated with the
    web connector installed on the machine where iWS is installed.
    Regards,
    Amar.

    <i>Can anyone tell me, as to whether there is any way
    for an application deployed on iAS to get the directory
    listing of files residing on a separate machine.</i>
    No. More specifically, the appserver doesn't have any special awareness of external filesystems. (The webconnector does not have any API's that would expose the webserver's files. That would be a huge security violation.)
    You could always NFS mount the webserver so that the appserver could see it. This has some security concerns, but you are going to have security concerns anytime that you are exposing your webserver's files directly.

  • How to disable the Directory listing for the whole server or a particular a

    Please let me know how to disable the Directory listing for the whole server or a particular application.
    Thank You

    I want to disable the tab focusing( tab index) for a JTextField objectsLook through the API and find methods with the word "focus" in the method name.
    Also can u tell me about how to change the tab index orders for JTextFields."How to Use the Focus Sub System":
    http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html

  • How to get our company listed in 'Top Contributing Companies'

    Hi,
    How to get our company listed in 'Top Contributing Companies'?
    Regards,
    Murali.
    Message was edited by: Murali

    Hi,
    It's just a standard footer I'm using, preventing me to look up if a user is already on the map or not.
    The SDN admins are rather busy with TechEd, so ther might be a delay.
    Don't worry you will get your points.
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • How to get workflow task list ID?

    I created simple workflow in Office 365 SharePoint 2013 using SharePoint Designer 2013.
    The action Assign a task to user (Task outcome to Variable: Outcome |Task ID to Variable: TaskID) was used.
    The variable TaskID had a value something look like
    902aa0e9-0d58-47c0-a3ba-da96ebd47651, but I need ID from a task list.
    How to get the task list ID in SharePoint Designer Workflow?
    I am very grateful in advance for any help.
    bnossov

    I created dictionary and create two variables:
    Name: Accept; Type: string; Value:
     application/json;odata=verbose;
    Name: Content-Type ; Type: string; Value: application/json;odata=verbose;
    Output variable: JSonRequestHeader.
    I called HTTP web service:
    https://xxxxxx/_api/web/Lists/getbytitle('WorkflowTaskList')/items?$select=ID
    I used Count Items in Variables: JsonRequestHeader(Output to Variable: count)
    The output variable count had value equals 2.
    When I printed service url in browser it gave me xml with all the items ID in the
    WorkflowTaskList.  There were eight .
    How can I take data from web service and put them in dictionary?
    I would be grateful for any help.
    bnossov

  • How to get current directory and enviroment variables

    Hello, 
       1.- Is there a global variable to get the actual (project, where is DSB and DSQ files) directory? 
       2.- Is there a way to get User directory like reading enviroment variables from Operative System? 
    Thanks in advance.
    PD: I'm using Dasylab12
    Solved!
    Go to Solution.

    Yes, use System Strings
    For example, ${DATA_FOLDER}.
    The easiest way to get the list is to right click and select Global Strings. The bottom half of the dialog box lists system strings, including date, time, the name of the worksheet, with or without path, the DEFAULT folders for worksheet, data, other, black box, etc. 
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • How to get the whole list of Iview Templates

    Hi,
    when I navigate:
    Portal Content -> Content Provided by SAP -> Templates -> Iview Templates
    I get a long list of templates including Url Iviews etc
    But, when I try to create my own Iview, the list of potential templates is much smaller, mainly including only the SAP related templates, BSP, Query, ITS etc.
    Does anyone know how to make the full list of Iview Templates available for the Iview creation wizard ?
    Thanks,
    Tomas.

    Hi Tomas,
    which iView templates are offerd within the iView creation wizard is determined by SystemAdmin -- Permissions -- Portal Permissions -- Applications.
    Normally, you will have to have SuperAdminRole to see/change these settings.
    Hope it helps
    Detlev
    PS: Please consider to reward points for helpful answers. Thanks in advance!

  • How to get the material list displayed in CU50 transaction into ABAP report

    How to get the 'KMAT" type material list displayed in CU50 transaction into ABAP report?
    I am getting the entire BOM when i am using the FM CS_BOM_EXPL_MAT_V2 in to the table in the report.
    But I want only the material list displayed in CU50.

    Hi,
    Could you please tell us how you found a solution to your problem?
    Thanks & regards
    Hassan

  • How to get the user list under role

    Hi Gurus,
    in mdm console, if you select a role, you will see the users who are assigned to this role.
    how can I get this user list through java api.
    Ouser server is  MDM7.1SP5
    Best regards,
    John

    Hello John
    you cann't get users list.
    you can get user roles information since SAP MDM 7.1 SP3:
    com.sap.mdm.security.commands GetUserRoles Command
    A command to retrieve the array of roles for the specified user
    more about api  you can read here(What's New in MDM Java and .NET API - part):
    http://help.sap.com/saphelp_nwmdm71/helpdata/en/13/041975d8ce4d4287d5205816ea955a/frameset.htm
    Regards
    Kanstantsin Chernichenka
    Edited by: Kanstantsin Chernichenka on Mar 11, 2011 3:10 PM

Maybe you are looking for