How to find the file by name and identify its type?

Hi,
In a folder thare are many files, the file types are doc, docx, pdf, and rtf. The file name is something like "FirstName LastName(more extrat letters).filetype".
Now I would like to find all the files with a certain name and identify their types. For example, by input "Bill Gates", I would get the list of all files :
Bill Gates.doc, Bill Gates-2010.pdf etc ...
Any good ideas are welcome.
Pengyou

For finding files whose names match a certain pattern, create a FileFilter or FilenameFilter that returns true when the name matches the pattern in question, and then call list() or listFiles() with that filter.
For identifying the "type", that depends what you mean. File's don't actually have a type. It's just that they're interpreted as such in some contexts. The simplest thing is to just look at the extension. You can be more sophisticated than that, but that gets complicated real fast. It depends what you're actually trying to accomplish.

Similar Messages

  • How to find the logins,program name and databases for a session id?

    I used the following the following query.
    select pr.spid ,pr.dbid,pr.program_name,pr.loginame,ss.session_id,ss.host_name,ss.login_time,db.name from master.dbo.sysprocesses pr,sys.dm_exec_sessions ss,sys.databases db
    where pr.spid = ss.session_id and pr.dbid = db.database_id
    order by ss.login_time desc
    Is spid in master.dbo.sysprocesses the same as session_id in sys.dm_exec_sessions and dbid in master.dbo.sysprocesses the same as database_id in sys.databases?
    My intention is to get the active sessions with the program name,login Name and database name corresponding to the session?

    1)Why you included the clause session_id > 50?
    Sessions with session_id <= 50 are system processes.
    2)Is there any problem with the query I used?
    You query was better than Latheesh's. To wit, his query will only show the database for sessions who are actually running something.
    On SQL 2005 and SQL 2008, this is the best solution:
    SELECT  des.session_id, des.[status], des.login_name,
            d.name AS database_name, des.program_name
    FROM    sys.dm_exec_sessions des
    JOIN    sys.sysprocesses p ON des.session_id = p.spid
    LEFT JOIN sys.databases d ON p.dbid = d.database_id
    WHERE   des.session_id > 50
      AND   p.ecid =0
    ORDER BY des.session_id;
    The condition p.ecid = 0 is needed to weed out extra rows when there are parallism in force.
    On SQL 2012, you don't need sysprocesses, but this works:
    SELECT  des.session_id, des.[status], des.login_name,
            d.name AS database_name, des.program_name
    FROM    sys.dm_exec_sessions des
    LEFT JOIN sys.databases d ON des.database_id = d.database_id
    WHERE   des.session_id > 50
    ORDER BY des.session_id;
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to find the current User Name and stored in which table

    In which table the current user name (Login) is stored?

    Hi Mohanapriya
    The query provided by Gordon can not run on query generator as the $USER is a runtime variable.
    You need to save it to a query then use it in a FMS(Formatted Search.)
    Just open a form(ex:sales order ), click the field in which you want to show the user name,
    then press ****+F2 or Tools->Search Function->Define,
    Search by Saved query,then assign the save query to the field.
    After that ,you can run the FMS(shift+F2) to get the current user info.
    Regards,
    Syn Qin
    SAP Business One Forums Team

  • How to find the File name using the FTP Adapter

    hi all,
    how to find the File name using the FTP Adapter with BPEL.
    Regards

    Found the solution for this.
    First In the mediator's routing rule use assign property $in.property.jca.file.FileName to $out.property.jca.file.FileName
    In the BPEL's receive activity go to the properties tab and get the property to a BPEL variable. That should do it.
    Thanks for the posts

  • I put in my memory card to the left side of the computer, but I cannot find the file of pictures anywhere. Its not even on my desktop. What should I do and how can I get it to show up on my desktop?

    I put in my memory card to the left side of the computer, but I cannot find the file of pictures anywhere. Its not even on my desktop. What should I do and how can I get it to show up on my desktop?

    If your Mac is new-ish and has one of the Lions as its OS, the drives, cards, USB sticks no longer show up, even though they're there. Go to Finder's Preferences and tick the corresponding items in the General and Sidebar tabs.

  • How do I find the report server name, and then run paper report from forms?

    How do I find the report server name, and then run paper report from forms?
    I am having a problem running report 9i from forms 9i (see below thread). How do I find out the name of the report server? I checked my C:\ids\reports\conf directory but don't see anything that gives me the name of the reports server. I also don't have a iashome directory.
    Also, I just want to run the paper report (not the web version).
    Thanks.

    Hi,
    please read teh Forms / Reports integration paper in teh Collateral section for Oracle9i Forms at otn.oracle.com/products/forms
    In summary, you have to create an external Reports Service that you can then give a name.
    Frank

  • How can I find the specific channel name and modify channel name in automatically in VBS?

    How can I find the specific channel name and modify channel name in automatically in VBS? (DIAdem 9.1)
    I would like to change channel name = "speed01" ... "speed10"  to  channel name = "velocity01"..."velocity10.
    martino

    Hello Martino,
    this script will help:
    Option Explicit
    Dim i
    Dim n
    For i=1 To 10
    If i < 10 then
    n = CNo("speed0" & i)
    Else
    n = CNo("speed" & i)
    End If
    If n > 0 Then
    If i < 10 then
    ChnName(n) = "velocitiy0" & i
    Else
    ChnName(n) = "velocitiy" & i
    End If
    End If
    Next
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • How to find the file that delete from time capsule?

    How to find the file that delete from time capsule?

    I mean I saved JPEG file in Time capsule and unfortunately delete the file. Can I get it back
    IF.... .no other backups have occured since you deleted the file, you might be able to retrieve it using an application like Disk Warrior. It's about $100 as I recall, and there are no guarantees that it will work.
    DiskWarrior 4 - The Disk Utility for Mac  Disk Repair, Mac Directory ...
    Any of the free or low priced utilities that you might see or try will not be able to retrieve a deleted file from a Time Capsule.
    If any backups have occured since you deleted the file, the deleted file has almost certainly been overwritten. No way to retrieve it in that case.

  • How to find the Standard DFF Name  In oracle apps

    hi,
    How to find the Standard DFF Name In oracle apps
    thanks

    1. Open the form
    2. Choose Tools--> Diagnostics
    3. In the block field choose $DESCRIPTIVE_FLEXFIELD$
    4. Field will show the list of all the DFF's enabled for that form.
    5. Choosing one will display the name of the DFF in the value field.
    Thanks
    Nagamohan

  • How to find the Last modified date and time of a package

    Hi,
    We need a clarification on how to find the Last modified date and time of a package in Oracle. We used the example below to explain our scenario,
    Lets consider the following example
    Let A, B be two packages.
    Package A calls the package B. So A is dependent on B.
    When A is compiled the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated.
    Now there a modification in package B so it is compiled. There is no modification in package A.
    Now when the package A is executed the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated but we did not make any change in Package A. Now we need to find last modified date and time of the package A . So we can not rely on the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS . Can u please tell us any other solution to get last modified date and time of the package A .
    Regards,
    Vijayanand.C

    Here is an example:
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 10:57:32 2004-05-20:10:57:32 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 VALID
    SQL> CREATE OR REPLACE PROCEDURE A AS
    2 BEGIN
    3 NULL;
    4 NULL;
    5 END;
    6 /
    Procedure created.
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 INVALID
    SQL> EXEC B
    PL/SQL procedure successfully completed.
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 11:01:53 2004-05-20:11:01:53 VALID
    Note that the date under the column 'created' only changes when you really create or replace the procedure.
    Hence you can use the column 'created' of 'user_objects'.

  • How to find the relation between PAY_ELEMENT_TYPES_F and GL_CODE_COMBINATIO

    Hi, could someone tell me how to find the relation between PAY_ELEMENT_TYPES_F and GL_CODE_COMBINATION tables
    that is because as you could know PAY_ELEMENT_TYPES_F holds the definitions of elements in Oracle HRMS and i need to find the accounting code of each element.
    Thanks

    Hi;
    Please check e-trm site for table relation,integration,explanation etc..
    etrm.oracle.com/
    Regard
    Helios

  • How to find the max session count and process count for a database

    Hi All,
    How to find the maximum session count and process count reached for a database over a period of 15 days?
    DB version:11.2.0.2
    OS:AIX

    Thanks for the link.
    The output of the below query that is given in the link shows the results for the last 10 or 12 days.. Is there a query which gives a result for the last 30 days?
    col metric_unit for a30
    set pagesize 100
    Select trunc(end_time),max(maxval) as Maximum_Value,metric_unit
    from dba_hist_sysmetric_summary
    where metric_id in ( 2118,2119) group by trunc(end_time),metric_unit order by 1;

  • How to find the link between strcture and query technical name

    Hi Guru's
    How to find the link between Strcture in the query and query technical name. In other way where used list of the structure  used in queries?
    I know we have table called RSZELTDIR which have the values of strcuture name. from here i do not find any link to query technical name.
    Please can anyone help me?
    Regards,
    Sirisha

    Hi ,
    For structure and query relationship, the structure has to be a reusable structure( a global one). Then you can right click in on the structure name (in BEX query designer) and select the where used list. You will find all the query names where it is being used.
    U can also check out tables RSRREPDIR and RSZCOMPDIR for other query properties.
    Thanks,
    Amit

  • How to find the Data source name on linux server

    Hello All,
    Good Morning...
    I created a rpd in my local machine and deployed on the server through Fusion middle ware.
    and copied the catalog file there in the server.
    While working on my local machine I have two odbc connections... one is for development and other is for production.
    at the time of deployment to the server I changed the development instance to production instance throught the connection pool.
    I am encountering the following error while working on the analyis....
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 16001] ODBC error state: IM002 code: 0 message: [DataDirect][ODBC lib] Data source name not found and no default driver specified. (HY000)
    I think this is because of the mismatch of the datasource name in server and my local machine...could you please tell me how to find the datasource names on the server?
    Thanks!

    Hi Dpka-
    I created two ODBC connections in my system.
    one for development and another for Production.
    while deploying the rpd to the server I changed the development login credentials with production login.
    The problem here is I just want to know whether Iam giving the same datasource name which was presented on the server or not.
    I don't have access to the server now.
    Is there any way to find out the datasource names which were presented on the server with the help of admin console?
    Thanks!

  • How to Find the file in UNIX?

    Hello Team,
    I Have below list files and i have to find the file with latest date and time
    CHECK_300914_200747_xxaa_account_name_20140930195924.txt
    CHECK_300914_203213_xxaa_account_name_20140930203055.txt
    CHECK_300914_205625_xxaa_account_name_20140930200219.txt
    CHECK_300914_211345_xxaa_account_name_20140930200446.txt
    CHECK_300914_213836_xxaa_account_name_20140930200718.txt
    CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    In a list of files "CHECK_300914_215928_xxaa_account_name_20140930201143.txt" is the latest file i.e. ddmmyy:300914 and hhmmss:215928
    Can you please help me to find the file in UNIX
    Thanks in Advance,

    touch CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    touch CHECK_300914_211345_xxaa_account_name_20140930200446.txt
    touch CHECK_300914_205625_xxaa_account_name_20140930200219.txt
    touch CHECK_300914_203213_xxaa_account_name_20140930203055.txt
    touch CHECK_300914_200747_xxaa_account_name_20140930195924.txt
    ll
    total 0
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:27 CHECK_300914_200747_xxaa_account_name_20140930195924.txt
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:27 CHECK_300914_203213_xxaa_account_name_20140930203055.txt
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:27 CHECK_300914_205625_xxaa_account_name_20140930200219.txt
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:26 CHECK_300914_211345_xxaa_account_name_20140930200446.txt
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:25 CHECK_300914_213836_xxaa_account_name_20140930200718.txt
    -rw-r--r-- 1 oracle oinstall 0 Oct  7 11:25 CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    We are interesting in file with maximal values in "field" 2 and 3 assuming that fields are parts of filename separated with "_". I especially created (the file we are interested in) CHECK_300914_215928_xxaa_account_name_20140930201143.txt file to be the first created/modified file.
    find . -name CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    ./CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    will definitely work. But we should know the file name. As for topicstarter note it is not the case.
    ls -tr . | tail -1
    CHECK_300914_200747_xxaa_account_name_20140930195924.txt
    gave incorrect file.
    ls -l . | cut -d" " -f10 | sed 's/\(^CHECK_\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\(.*\)/\1\4\3\2\5/' | sort -r | head -1 | sed 's/\(^CHECK_\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\(.*\)/\1\4\3\2\5/'
    CHECK_300914_215928_xxaa_account_name_20140930201143.txt
    P.S.
    I much apologize for an error in back filename transformation. Correct is marked in bold red.

Maybe you are looking for

  • Rebuilding partitions indexes takes a lot of time

    We have 5 partitions in one table with the following sizes: P1 ---- 160MB P2 ---- 160MB P3 -- 1280MB P4 -- 5400MB P5 - 24640MB Nobody is connected to the instance, no apps is running on this server, the server is dedicated to the database and only fo

  • Skin doesn't automatically load

    I'm having a problem with the selected flash skin automatically loading when the help files are moved to my organization's server. Instead of automatically loading, the default page appears with a "show" link at the top of the page. If you click this

  • HT4623 How to update my iPad to iso 6?

    How to update my iPad to iso6 ?

  • Distribution of sap systems

    hello, do anyone know the distribution of the sap systems to the different operating systems. is there a diagram, like a cake diagram, on the sap marketplace where you can see the distribution. thanks winfried geisselbrecht

  • I am getting an error message " AE error: Ram Review needs 2 or more frames to playback".

    In  Preferences tab under Memory and Multiprocessing my settings are.       Installed Ram: 6GB      Ram reserved for other applications  1.5GB      Ram available for AE  4.5GB      Checked Render Multiple Frames Simultaneously      Ram allocation per