How to identify the file type in a safe way

I need to identify the filetype of a file in my disc.
I watched over internet and i've found this good site:
http://filext.com/
that supplys the "magic bytes" for many kind of files.
I have also looked over internet for some ready class that identify different file types, and I have found FFident:
http://schmidt.devlib.org/ffident/index.html
Do you know any other Java package/class that is able to identify correctly the file types?
Thank you,.

The OS just watch the extension of the file.Not always. If you create a word doc but name it with
some other extension, the OS still can determine that
it is a word doc.On which OS?
if i take foo.exe and i rename foo.doc so my OSwill
try to open it as a MS Word Document.Again, garbage in, garbage out.What you mean?
If I create a MS Word Document for a file .doc that is not a real .doc and it is not able to read, i will just lose cpu time and a lot of memory.
So it is important to understand if I need really to open MS Word watching what is the real file type
Either way, you're going to be doing way too much
work (and wheel-reinventing) if you're going to build
your own detection scheme.In the SDK there is not any file type checker, and if eventually really exists an OS like you say that is able to read inside the file, i prefer to have my own Java class that do that work in a safe and opensource way.
However in my first post i've given a site with some java code that do what I need, i just was asking if anyone know if there is any ready-to-work java class that is better for doing this work.

Similar Messages

  • How to find the file type without the file extension using indesign javascript (.jsx)

    hi,
    How to identify the file type (eg: InDesign or Quark) without knowing their file type. How can we find what kind of file is that??? without their extension like ('.indd','.qxd') before import to the document...

    Hi subha_oviya,
    Take a look at the file filtering section in the InDesign CS3 sample script ImageCatalog.jsx to see how to look for file types. I'm assuming that you're using InDesign CS3, and that you're using the Mac OS--you didn't say.
    Thanks,
    Ole

  • [CS3][JS] How to get the file type of current document

    Hi,
    How to get the file type of current opening document (e.g., tif, jpeg, png) using JavaScript with Photoshop CS3.
    I am using file object the open the files one by one in the folder (the files sometimes don't have the extensions).
    If the current document is in tiff format then I need to convert to 8-bit, if its an Jpg image then needs to ignore the file.
    Regards,
    Karthik

    Do you really need to know the file type? What about just checking the bit depth?
    var doc = activeDocument;
    if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) {//Not 8 bit
    doc.bitsPerChannel = BitsPerChannelType.EIGHT;
    //do your save etc
    }else{
        //Ignore

  • How to open the file types of iOSApp(ipa),EPUBFile(.epub) in windows 7(32 bit)

    How to open the file types of iOSAPP(ipa),EPUBfile(.epub) in windows 7(32 bit)

    iOS apps can be added to an iTunes library and thereafter transferred to an iOS device. They cannot be opened directly on a PC.
    epub files can be added to an iTunes library, and thereafter transferred to an iOS device where they can be read with the iBooks application. Files protected with Apple's DRM cannot be opened directly on a PC, though there are programs such as Kindle and Calibre that will open non-protected epub files.
    tt2

  • How to change the file type from IMOVIE PROJECT to other types of file

    how to change the file type from IMOVIE PROJECT to other types of file??
    thank you very much for your help=]

    I am not sure what you mean, but once you make a project. Then go to the share menu and you can export the project to iDVD, itunes, mobileme, quicktime.
    Share export quicktime movie will allow you to export to a variety of codecs. What specific export are you looking to share the movie in? What is the final source that the movie will be displayed?

  • I have a keynote presentation that i built a while ago. How do identify the file names of the video files that are in the presentation?

    I have a keynote presentation that i built a while ago. How do i now identify the file names of the video files that are in the presentation?

    With your presentation open, click on each movie element and read the name in the Metrics Inspector > File Info.

  • How to filter the file type and size when uploadind files into APEX

    Hi,
    I was wondering how I can do to validate the size of a file, before moving it to my table ? I'd like to filter the file type, but for this one, I think I can use regular expressions in a validation process.
    I don't know if there is a way to read the file size even before sending it into the temporary file table.
    Thank you
    Leinad

    Hello Leinad,
    AFAIK, you have to create an APEX validation (PL/SQL returns Boolean or Returns error text), which will query the file details from apex_flow_files table. Here you can get filetype and size etc.
    So just validate and if any validation fails, then delete the file from apex_flow_files and riase error message.
    Regards,
    Hari
    P.S. Please note that, if there are other apex validations on your page and if they fail, still apex will load the file into apex_flow_files table. So it's good idea to create a validation (PL/SQL) which will fire (condition) when inline validation errors occured. Make sure that this is the LAST validation on your page in sequence. And here you can write code to delete the file from apex_flow_files table.
    Edited by: Hari_639 on Sep 20, 2012 10:09 PM

  • How to limit the file types to be uploaded to KM folders?

    We need to restrict files uploaded to KM to the following types: *.pdf, *.doc, *.ppt, and *.xls.  Uploading the other file types will need to give user an error message. 
    1) Is there a configuration to satisfy this requirement?
    2) If not, what is the work-around? How to we achive this goal?       
    For example:
    1. Go to u2018Private Documents and Discussionsu2019 hyper link.
    2. Click on Owner.
    3. Click on 'Send E-mail' hyperlink
    4. Click on the 'Browse' button, selects a file (with .exe extension)
    5. Click on 'Open' button and 'Upload' button (would like to give user an error message at this point)
    Thank you so much for your help.  I have searched the forum but did not find any specific answers to this issue.

    Hello,
    I have the same problem, unfortunatelly there's no standard way to do this and developing
    custom repository services or upload commands may not attend totally my requirements.
    An idea is to create FSDB CM Repositories or to map external File System repositories for
    specifics needs, so once the documents are stored into a file system (windows in my case)
    it's simple to implement the organization's policy, be it file types, maximum folder size, clean-up routines, etc..
    However there are pros and cons, some services are not available and there are some restrictions,
    here's more detailed information: http://help.sap.com/saphelp_nw04/helpdata/en/62/468698a8e611d5993600508b6b8b11/frameset.htm
    As for the original folders on DB mode, we've been running KM detailed reports once a week
    and deleting the "illegal" files found
    kind regards,
    Rafael

  • How to get the File-Type from a BLOB-Column

    Hi all,
    I have the database table with the BLOB-Column. In this column are Word/Pdf/Excel/... files can be stored.
    Now I want to open these Files from Webforms.
    I can download the file from database to the client and then open the file with client_ole2.CREATE_OBJ('Word.Application');
    But I can not be sure that the file is a Word-Document.
    How can I know which application is saved in the BLOB-column?
    Regards

    Hi Francois,
    thank you.
    Unfortunatelly I do not know the interMedia functions. Can you send me an example with interMedia?
    I am working with your solution with WEBUTIL_HOST.blocking.
    But when I do not give the extension for the file, in that the BLOB will be temporary stored, I get to see the Windows "Select Program..." window. When I select Word or anything else then the file will be opened, but the locking does not working.
    Any ideas?
    Regards

  • How to identify the media type 32 or 64 bit from installed oracle client

    hi guys,
    I have oracle client 11g r2 installed in my machine which is a AIX. but not sure of the media type. 32 or 64 bit. this information is required further to proceed in my further application compatability.
    tilll the previous release there was many hints like.. lib and lib32 in various locations. but not in 11g r2 i guess.
    can someone please help me to find out this piece of information..
    thanks in advance.
    rgds
    Shravee

    908038 wrote:
    hi karthick,
    thanks for replying. first of all i would like to say that I was not able to find the path which you have mentioned below.
    but i understood your intentions.
    so directly looked for a executable file of sqlplus underr oraclehome/bin. and i got few error messages, saying sqlplus could not be loaded. this could be because my 10g is currently configured. and not 11g as we dont want to disturb the environment without confirmation.You said this was AIX. So when you log on to the server, your "environment" only exists for that session you have created to log on. Set ORACLE_HOME to point to your 11.2 installation, and set PATH to point to $ORACLE_HOME/bin. Those settings are only good for that session, so will not impact anything else.
    If sqlplus reports 64 bit, well, that's obviously 64 bit. If it's 32-bit, it won't say anything about it, so "not 64 bit" must be 32-bit.
    >
    however, i tried to execute the same file for 10 g to check if 10g gives any info, but only got the version not 32 or 64 bit.
    rgds.
    Shravee

  • How to identify the object type in xpress

    In ui global.startdate is evalued with Date object type when use display class as DatePicker. After save, the global.startdate is String type. The other place in the code has use this global.startdate to convert to special date string. The problem is how to detect what data type the global.startdate is at one particular moment?

    In my case I do the following.
    1. Use the following rule to display the date in the desired format.
    <invoke name='dateToString' class='com.waveset.util.Util'>
    <ref>inputdate</ref>
    <s>MM-dd-yyyy</s>
    </invoke>
    At any point in time if one wants to know, one explicity needs to convert the java.util.Date obtained from datepicker using dateToString method in the Util class.
    2. When one wants to insert the date into the database then the following can be done.
         // First Convert the dates into appropriate formats
         SimpleDateFormat formater = new SimpleDateFormat("mm-dd-yyyy");
         java.sql.Date _startDate     = null;
         if(startdate != null) {
              java.util.Date parsedDate = formater.parse(startdate, new ParsePosition(0));
              _startDate = new java.sql.Date(parsedDate.getTime());
              System.out.println("_startDate::::"+_startDate);
         }

  • How to identify the Encoding type in an XML

    Hi all,
    Is it possible to identify the encoding set to and XML programatically?
    for example :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <student>
    </student>
    in this is it possible to find out the encoding value set (ISO-8859-1) ?
    Thanx in Adv,
    Potluri

    Hi, if you have a parser that is only DOM level 2 compliant then there is no way to get at the xml declaration via the JAXP and org.w3c.dom apis. It is expected that DOM level 3 will have the functionality in the Document interface to access the xml declaration attributes like the encoding. I don't know if there are any DOM level 3 parsers available, check xml.apache.org to look at the xerces parsers. However as xml files are text files you could right a program using java.io package to look for the <?xml version ...> tag and then to search that line for the encoding.
    Hope this helps.

  • How to identify the files that are exported but still present in Oracle UCM

    Hello All,
    I am using Oracle UCM 11g on Windows OS.
    I want to know that if i have exported the contents from Oracle UCM to external file system, but keeping the contents and metadata into the Oracle UCM. How one will be able to identify that the contents that are being exported? Will there be any attribute set for any such contents indicating that these contents were exported?
    Your help or hint will help me out in resolving the problem.
    Thanks in Advance
    Dipesh

    Hi Srinath,
    Thanks for the reply.
    I did not find the place where to check this?
    On the content tab of the Repository Manager Applet, what is the column do i need to set for indication that the content is archived?
    Regards
    Dipesh

  • How to determine the file type in FTP

    What command code that should be sent to FTP server in order to identify if
    a given name (return from NLST command code) is a file, a folder, or even a link?
    Any help is greately appreciated.
    Thanks in advance,
    ferdieabtik

    user-exit for outbound COSMAS01
    Idoc extension

  • 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.

Maybe you are looking for