File Finding on Unix plateform

hey, I have a quick question when your doing a recursive file search/scan whatever, on unix/linux you have can symbolic links that can potentially point back to the parent directory or multiple directories above the immediate parent directory. Java interprets these links as folders, whats the best way to prevent infinite loops when scanning for a file on a unix platform. essentially, how do you determine a link from a folder in java? any really simple way?
Thanks in advance

If there are no symlinks supported for a particular platform then the method should always return false!Likewise the isResourceFork() should return false if the given platform (and/or file system) does not support resource forks - whatever they might be in other platforms.
And isShortcut() should return false if the given platform does not support Shortcuts.
And isUnixDomainSocket() should return false if the given platform does not support Unix Domain Sockets.
And isNamedPIpe() should return false if the given platform (and/or file system) does not support named pipes (fifos).
And isMessageQueue() should return false if the given platform does not support message queues or if it supports them but not though file names.
And isCatalog() should return false if the given platform does not work with the catalog/member paradigm.
And isSequentialFile() should return false if the given platform does not support the notion of sequential files but considers the files a a stream of bytes as modern OS'es do. (In good old mainframe days, sequential and index-sequential files were supported by the OS.)
...etc...

Similar Messages

  • Where are the MMB files stored in unix box

    Hi all,
    Can anyone tell where are the MMB files stored in unix box. Thanks in advance.
    Regards,
    Sandeep V

    Hi Thomas,
    Thanks for the reply, I got the FNDMENU.mmb file , but Iam not able to find the menu item which Iam searching for. There are some special menu items like SPECIAL , SPECIALB and SPECIALC. So, when I select release from plan menu item special27 is called , but Iam not able to find release in this menu. Can you please help me in this regard.
    Regards,
    Sandeep V

  • IDE /Tool which can open  a jpd file stored in UNIX  from our windows deskt

    wanted to know which IDE /Tool can open a jpd file stored in UNIX from windows desktop

    Hi Antônio G,
    Based on your description, I’m afraid that it is not the correct forum for this issue, since this forum is to discuss:
    Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
    To make this issue clearly, would you mind letting us know more information about this issue? Which language are you using? Which kind of app are you developing?
    Reference:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9e1857d-dd5b-443b-8633-397aea6e7b8c/help-on-properly-handling-wmf-mmanisotropic-image-in-rtf-file-when-extracted?forum=csharpgeneral
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/5b99d331-ef56-4d60-bf12-3e3b70783376/how-to-convert-a-hex-string-save-in-a-rtf-file-into-an-image-jpg-or-bmp?forum=csharpgeneral#a9219408-f73b-4e98-a9d8-7a1e0f20cdd9
    Maybe you could select the language development forum for this kind of issue. If not, please let me know more information about it, I will help you find a more appropriate forum.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • To read flat file from a unix server

    We need to read a flat file from a Unix server, where our Database is located.
    The location gets created correctly.
    But while we are trying to import files from the location in Design Center , we get an error that "directory does not exists", although the directory has all the permissions.
    Can someone please suggest how should we create the location so as it can read the files.
    Please Reply ASAP......

    We have started Design Center on a local machine(Windows Machine) with uaer as repository owner of the server,
    In the design center we can not sample the file till we import it,
    can you please tell how to sampe the file without importing it.
    Also a location pointing to server location gets easily created on the design center and the file module points to that location only, but when we try to import the file through that location, it says directory does not exists, although oracle user has all the read write permissions on the directory......
    Please help!

  • Difference in reading a text file in Windows & Unix

    I have a code which is working fine in windows but is stopping after reading the first line of a text file in
    Unix. The code is something like below:-
    declare
    file_handle text_io.file_type; /*running form*/
    filename varchar2(60);
    v_line varchar2(200);
    begin
    message('before fopen');
    filename:=:file_name;message(filename);
    file_handle:=text_io.fopen(filename,'R');
    loop
    begin
    text_io.get_line(file_handle,v_line);
    --:line:=v_line;
    exception
    when no_data_found then
    text_io.fclose(file_handle);
    message('NO MORE DATA IS FOUND ');
    temp:='stop';
    exit;
    when others then
    text_io.fclose(file_handle);
    message('ERROR ');
    exit;
    end;
    mob_no:=substr(v_line,1,10);
    begin
    message(' Mobile NO is '||mob_no);
    message(' Mobile NO is '||mob_no);
    exit when temp='stop';
    end loop;
    commit;
    message('File SUCCESSFULLY LOADED........');
    message('File SUCCESSFULLY LOADED........');
    end;
    Is there any difference in reading a text file in Windows & Unix.
    I hope, my question is clear. Please help in solving the doubt as it is urgent.
    Regards.

    There is no difference in reading a file - you use TEXT_IO in the normal way. However there is of course a difference in the format of text files between Unix and Dos so if you had say transferred your test file from Dos to the Unix box for testing strange things might happen if you had not transferred in ASCII mode.

  • Why are the DNG Thumbnails of my Sony DRC RX100 not shown in the File Finder of my Mac?

    When I first import the original RAWs from my Sony DRC RX100, I can see the thumbnails in the File Finder (so my Mac with OSX 10.9.1. is perfectly fine), but after reworking them with Lightroom and exporting them as DNG files, the pictures are not shown any more as thumbnails in the file finder, but as empty white boxes. The curious thing is that the RAW pictures shooted with my Nikon D5200 do not have any visualization problem after exporting them from Lightroom.  The problem is very disgusting, as I can not search for pictures in the file finder. And Adobe did just close my open request on this issue (case #0180632682) without my consent and without any solution! Who else has got this problem and knows if there is any help to this stupid phenomenon? Does anyone at Adobe take care at all?
    Thanks!
    Tinero

    I think that this is a Lightroom problem because the original Raw files from the camera card are shown as thumbnails in the file finder, but after importing them into Lightroom as dng, retouching them and exporting them with Lightroom, the files are not shown any more. Obviously my sony RX100 camera is not the problem, at least not for my Mac. As Lightroom always needs to work together with a windows PC or a Mac, Adobe should ensure the compatibility of the functions with the host system. I think that is what all consumers logically expect from Lightroom. And a photography SW should be able to show fotos and export visible foto files...
    The very same Dng files from my other camera (a Nikon d5200) do not have this problem at all, although I export them in the very same format as the pics from my Sony, which is not at all an exotic camera. This is very confusing.
    I export dng files because this is the Lightroom own raw format that keeps the original quality of my raws. TIFF files are too large, and jpegs sensibly reduce the quality. So there is no option. I need to stay in Raw. Do I have any other quality options?

  • File transfer from UNIX server to Windows server path

    Hello Experts, (Gud Even Gud Aft & Gud Mor)
    Is there a way to transfer file from UNIX server(Oracle database), to Windows server? All I know if Windows path. I am able to read the file as it is on server, however it does not recognize Windows directory at all.
    If you can share some documents around this to study, I will be grateful.
    Regards,

    34MCA2K2 wrote:
    Is there a way to transfer file from UNIX server(Oracle database), to Windows server? All I know if Windows path. I am able to read the file as it is on server, however it does not recognize Windows directory at all.Yes it is possible. Samba on Unix sharing the directory containing the file. NFS on the Unix server sharing the directory containing the file. FTP server on Unix allowing the file to be read and copied. OpenSSH on the Unix allowing the file to be read and copied via scp (secure copy).
    But seeing as this is an Oracle database forum (not an operating system forum), and the subject matter is the database server languages SQL and PL/SQL, here is a PL/SQL solution.
    Create a table using the BFILE data type for referencing the files on the Unix o/s. Provide a web enabled procedure for downloading the files via HTTP using a web browser. This procedure will look something as follows:
    --// URL example: http://my-server.my-domain.com/MyDAD/MySchemaName.StreamFile?fileID=1234
    create or replace procedure StreamFile( fileID number ) AUTHID DEFINER is
            mimeType        varchar2(48);
            fileName        varchar2(400);
            lobContent      BLOB;
    begin
            --// read the LOB from a table (this example uses the
            --// Apex file uploads table - change it to your own files table)
            select
                    f.filename,
                    f.mime_type,
                    f.blob_content
                            into
                    fileName,
                    mimeType,
                    lobContent
            from    FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$ f
            where   f.id = fileID;
            --// format a basic HTTP header that describes the file stream send
            OWA_UTIL.mime_header( mimeType, FALSE );        -- e.g. text/csv text/plain text/html image/gif
            HTP.p( 'Content-Disposition: attachment; filename='||fileName );
            HTP.p( 'Content-Length: ' || DBMS_LOB.GetLength(lobContent) );
            OWA_UTIL.http_header_close;
            --// now write the BLOB as a mime stream using the Web Procedural Gateway's
            --// doc load API
            WPG_DOCLOAD.download_file( lobContent );
    exception when OTHERS then
            --// Decide what HTML to generate (if at all) if there is a failure
            --// (usually not a good idea to show database errors to the
            --// web browser client as that can provide technical details
            --// that could be useful for exploiting the database)
            HTP.prn( 'StreamFile() failed with '||SQLERRM(SQLCODE) );
    end;
    / On Windows, IE can be used interactively to copy the file across. For automation (via PowerShell or console jobs), use a command like tool like wget* to download the file.
    If you do not want to use SQL or PL/SQL as the file copy mechanism, then please close this thread (mark as answered) and take your question to an appropriate forum.
    <i>* - see http://gnuwin32.sourceforge.net/packages/wget.htm</i>

  • Can I change preferences for the File Find window

    In the search window that opens when you go to File > Find, how do I save changes I make to the search parameters? I want the same settings every time that window pops up. Is this possible? Thanks.
    tlbb

    Hi, and a warm welcome to the forums!
    Are they the settings that are available in System Preferences>Spotlight?

  • Custom File Finder

    Hi everyone,
    I am trying to build a custom file finder to search for my mp3 files on my computer. As you can see my nickname, I am a DJ, so I have lots of mp3 files on many directories on my PC and sometimes it's difficult for me to find the song I am looking for. I want to take advantage of JAVA to build my file finder. I am planning on having two command line arguments. One with the path string and another with the filename and extension. (Just in case I want to use to find other files than .mp3 such as .wma, and .avi.)
    If you guys have any ideas how I can do this, please let me know. Also, if you have any example or references I can study from, I will really appreciate it.
    Thanks in advance.

    Like I said before, I was trying to write a code to search for files on my computer. The program would ask me for the path, and also for the filename and its extension. After that, the program would scan the whole directory and after the whole directory was scanned, I would get a list of all the files in there and the path of the file I was looking for. (only if the file was found.)
    After reading the file class, I got this code but I am not getting the path for the file. I only get the list of all the files on the directory. I think I got a logical error somewhere because the program is compiling and I am not getting run-time errors.
    If anyone have any suggestions on how I can fix my code or knows how to improve it, please let me know.
    Thanks in advance.
    import java.util.*;
    import java.io.*;
    public class FileFind
        static final int      MAX_DEPTH  = 20;  // Max 20 levels (directory nesting)
        static final String   INDENT_STR = "   ";                 // Single indent.
        static final String[] INDENTS    = new String[MAX_DEPTH]; // Indent array.
        static boolean done = false;
        static String found = "not found";
        //===================================================================== main
        public static void main(String[] args)
            //... Initialize array of indentations.
            INDENTS[0] = INDENT_STR;
            for (int i = 1; i < MAX_DEPTH; i++) {
               INDENTS[i] = INDENTS[i-1] + INDENT_STR;
            System.out.println("Enter the directory you want to search.");
            System.out.println("Do not use quotations marks. Use \\ instead of \"");
            Scanner input = new Scanner(System.in);
            File dir = new File(input.nextLine());
            //===============================================
            System.out.println("Enter the file name and its extension");
            System.out.println("Do not use quotations marks.");
            File filename = new File(input.nextLine());
            if (dir != null && dir.isDirectory()) {
                listRecursively(dir, 0);
                //====================
                if(dir.getName().equals(filename.getName())){
                     done = true;
                     found = filename.getPath();
                //=============
            } else {
                System.out.println("Not a directory: " + dir);
            //======
            if(done == true){
                   System.out.println("The file's path is: "  + found);
              //=====
        //========================================================== listRecursively
        public static void listRecursively(File fdir, int depth)
            System.out.println(INDENTS[depth] + fdir.getName());  // Print name.
            if (fdir.isDirectory() && depth < MAX_DEPTH) {
                for (File f : fdir.listFiles()) {  // Go over each file/subdirectory.
                    listRecursively(f, depth+1);
    {code}
    Edited by: DJFONSO on Nov 10, 2007 10:12 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Download Excel file in the Unix directory of Application server

    Hi Friends,
    I have a requirement  of downloading the Excel file in the Unix directory path of the application server,i just need your inputs,it would be great help if you can send any sample coding for downlading the file in the Unix directory?
    Regards
    Dinesh

    You can use the following fm
    RZL_READ_FILE
    or
    use OPEN DATASET FOR INPUT.

  • How to upload pdf file format in unix file directory?

    how to upload pdf file format in unix file directory?

    Hi Karthikeyan,
    If you have PDF internal table with you, You can follow the below method to upload into Unix directory.
        DATA:file_path TYPE char100 VALUE '/usr/sap/tmp/rep_out.PDF'.
        OPEN DATASET file_path FOR OUTPUT IN BINARY MODE.
        IF sy-subrc EQ 0.
          LOOP AT it_pdf.
            TRANSFER it_pdf TO file_path.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET file_path.
    Thanks
    Venkat.O

  • Photoshop .psd files converted to Unix Executable files

    I'm an illustrator and I store my art on CDs and DVDs. After a period of time my files are converted from Photoshop .psd files to Unix Executable files and I can't open them. What can I do to get my work back??? -and keep this from happening in the future. Why does it do this????
    Thanks for any help.

    The file sizes range from 22.2 MB to 67.9 MB.
    Size isn't the issue then. Linc was asking that question because we see that with other file types. Older fonts in particular, which have all of their data in the resource fork. If that gets stripped, you end up with a zero byte file.
    Does that mean I'll have to go through the Adobe authorization process for Photoshop again?
    If the version of Photoshop you're currently using is already activated, then no. Either way, it has nothing to do with .psd files showing as UNIX executables.
    In Windows, any file that doesn't have an association to a program is displayed as a white, dog-eared piece of paper with the Windows logo in the middle. That's Windows' way of saying, "I have no idea what this is." In OS X, (except for those files which actually are UNIX executables), displaying them as such is OS X's way of saying the same thing.
    I thought I was home free when the icon changed to a thumbnail picture of the illustration, but PS refuses to open it saying it is not a Photoshop file. ???
    Now that is weird. As of Snow Leopard, Apple put the old Type and Creator codes to rest. It will read them as a last resort to try and identify an older file, but none of Apple's applications add them to any file they save. For better compatibility with Windows, and OS X's own underlying UNIX core, file extensions have taken their place. So adding a .psd extension should have worked. Without playing with one of your files, I couldn't tell you why Photoshop declared it wasn't a valid .psd image.
    On a side note, Apple added Uniform Type Identifiers to OS X to keep things separate. A big problem in Windows is that multiple apps may use the same file extension. EPS is a big one in printing. So you have Photoshop, Illustrator, Freehand, Quark and others all using .eps for Encapsulated PostScript files. However, Windows can only associate one application to any given extension. So if Illustrator happens to be the one tagged to .eps files, it will try to open any file ending in .eps, no matter what program actually created it. OS X keeps them separate with Uniform Type Identifiers. So even though multiple files may have .eps file extensions, the extra metadata keeps track of what program it actually belongs to.
    This is what is part of the LaunchServices database, and was why it was my first suggestion. If that database is wonky, you'll see weird things like this. Have you tried clearing it yet?
    The files are fine when newly burned to CD. It is only months, or years, later that they become Unix Executable Files.  This has happened to just about all of my CD backups and it's frustrating to think that CD backup doesn't work across newer OSs and Photoshop upgrades. I suspect that may be the problem, but it just shouldn't happen.
    That shouldn't make a difference. I've got a bunch of very old files created in Photoshop back from OS 8 on CD. No file extensions, as nothing did at the time. Just Type and Creator codes. They all open fine in PS CS5.5 in Snow Leopard, though the native Photoshop files do need to have a .psd extension added.

  • Copy Files Between Two Unix Computers

    Hi,
    I am trying to write a piece of code that will copy bunch of files from one Unix computer on to another Unix computer. On windows it seems to be pretty straight but on Unix I am trying to understand best way of copying the files. I don't have much expertise in Unix.
    Is using FTP the only option for Unix?
    I am not able to create a FILE object by referring to a file on some other Unix box? I tried new File("//unixbox2/temp/123.txt");
    Please let me know the different ways to copy files between Unix computers.
    Thanks
    Gautham

    This's a simple example of how you can send a file form one computer to another
    import java.io.*;
    import java.net.*;
    public class Prf extends Thread {
         public void run() { //Read form file and writer to socket
              try {
                   Thread.sleep(100);//sleep(100) while server is getting ready to accept connection
                   System.out.println("Connecting...");
                   Socket soc = new Socket("localhost",4070);
                   OutputStream outS = soc.getOutputStream();
                   FileInputStream fis = new FileInputStream("input.dat");
                   int i = 0;
                   byte[] b = new byte[1000000]; //1MB buffer
                   for(;;) {
                        i = fis.read(b); //read from file (i - number of read bytes)
                        if (i != -1) {// checking for end of data
                             outS.write(b,0,i); //write portion (0..i) of bytes to socket
                        } else {
                             break;
                   fis.close();
                   outS.close();
                   soc.close();
              } catch (IOException e) {
                   System.out.println(e.getMessage());
              } catch (InterruptedException e) {
                   System.out.println(e.getMessage());
         public static void main(String[] args) {//Read from socket and write to file
              Prf prf = new Prf();
              try {
                   ServerSocket sSoc = new ServerSocket(4070);
                   prf.start(); //start writer
                   Socket soc = sSoc.accept();
                   System.out.println("Connection's accepted");
                   InputStream inS = soc.getInputStream();
                   FileOutputStream fos = new FileOutputStream("output.dat");
                   int i = 0;
                   byte [] b = new byte[1000000]; //buffer
                   while (true) {
                        i = inS.read(b);//read from socket (i - number of read bytes)
                        if (i != -1) { //check for end of date
                             fos.write(b,0,i); //write portion (0..i) of bytes to file
                        } else {
                             break;
                   fos.close();
                   inS.close();
                   soc.close();
                   sSoc.close();
              } catch (IOException e) {
                   System.out.println(e.getMessage());
    }

  • When searching for an image in Finder on iMac, I found hundreds of images of printers !! All sorts of printer images which I certainly haven't loaded on.I went to Finder, File, Find and Image and there they are, hundreds,if not low thousands of them.

    I was searching for an image on my Imac and when I went to Finder,File,Find and then Image, I found hundreds if not early thousand images of printers ! Amazing in one way but I didn't put them on my machine and don't really want them there.Did they come pre-loaded? Can I delete them safely? Thanks

    Almost certainly, no absolutely not once you start deleting stuff like this that you think is not needed, eventually you'll trash something essential and cause yourself a lot of heartache.
    There are numerous files classed as images, some will be temporary files in browser caches, others system files, others your "real" images, others files which are not really images but appear to be.
    The amount of space of what I presume are essentially icons of printers will will be minimal, lets say these images are  5k in size (I guess they are much smaller?) and there are 1,000 of them, thats only 5Mb. No doubt your disk has multiple gigabytes free, eg thousands of times as much free as you'd save by deleting all of them. So you might gain back an extra 0.0001% disk space*. NOt worth the time, let alone the risk, plus then you'll get into a mindset "hmm, I dont think I can possibly need this 23byte file either I'll delete that as well etc, and then "problem......". 
    Where are the images stored? It may be that at some time you were searching for a new printer and these images are from that exercise (though I doubt you looked at thousands?) in which case they are in your browser cache and you can always delete that through the browser, but that space will be overwritten by other images anyway.
    "If it ain't broke, don't fix it" is a motto to work by with computers.
    *( or, if you really do need the (say) 5MB of disk space back because you are running out, this would only be a very temporary solution and that wont have done you any good)

  • "File, Find, Searching "This Mac" or "New Finder Window" not finding files ?

    I an iMac 7,1, Mac OS X 10.6.8, Build 10K549,
    I have noticed on many occasions recently that when I ma using either ...
    File, Find, Searching "This Mac"
    or
    "New Finder Window"
    I am NOT finding the files I am looking for ...
    I now they are there, so I go through all my folders, and find the files, or folders I am looking for ...
    So why could this be happening, why are they not found in the search ?
    Is there a fix or addition ?

    As baltwo eventually explained, you have to add the search criteria "System files" to your search, with the option "Include" selected, to find many items Spotlight otherwise excludes from search results. Alternately (& quite ridiculously), if your search is restricted to the parent folder containing the item, you don't need to add this.
    For example, if you open /Library in the Finder, enter "Desktop Pictures" in the search box, you won't get it in the results with the default "This Mac" location, but if you click "Library" for the location, you will. (Yes, many users think this is bizarre, "what were they thinking?" behavior.)
    What Spotlight considers "system files" is only slightly less bizarre, as you will probably discover once you start using it to broaden searches. For instance, Safari history items & Mail.app messages are not found unless you include system files, but many files like C Header Source files (in System/Library/Frameworks) are found without including system files in the search.
    When it was introduced in Tiger, Spotlight was supposed to be a next-generation search engine, capable of accurately guessing what you were looking for (& filtering out what you weren't) with near-sentient intelligence. I think almost anyone who used that version will agree it did not achieve that lofty goal. Apple apparently agreed, or at least listened to the complaints enough to realize it needed rethinking. Unfortunately, what its designers came up with for the Leopard rethink feels like an early beta version, full of hastily implemented, quirky features that never got sorted out before it was released.
    We can only hope that we won't have to wait for OS 10.6 for a more mature, less quirky version.

Maybe you are looking for