How to Find there is a file in directory or not?

Hi,
In my application there is a module in which I have have to export files.
if in exported file there are directories ..then zip them all.
Zip only when they contain any files...
Can you please help how can I find that Directory has a file or not...
any example code ...
Bunty
Message was edited by:
bunty_india

Sorry...
I have done this recursively...in the following program
Only problem left is .....when ever the following program found File means go to the else part the control should stop & come out out of the function & return true.....
How can i return this on finding First file.....
Please help
import java.io.*;
public class DirFileFind
public static void main(String args[])
    File ff=new File("C:\\ccm\\OutPutArtifacts");
    int flag = getDir(ff);
    if (flag > 0)
        System.out.println("Zip Created Successfully!! " + flag );
    else
        System.out.println("Oops I Did it again :( " + flag);
    public static int getDir(File dir)
       // boolean aFlag=false;
        if (dir.isDirectory())
            String[] temp=dir.list();
            for(int i=0;i<temp.length;i++)
                //System.out.println(temp);
getDir(new File(dir,temp[i]));
System.out.println("It Is a Directory " + dir.getName());
//System.out.println("It Is a Directory " + dir.getName());
//aFlag=false;
return 0;
else
System.out.println("It Is a File " + dir.getName());
// aFlag=true;
return 1;
Message was edited by:
bunty_india

Similar Messages

  • How to find whether the output file is generated or not?

    Hi,
    I ran EDI 855 program for one of our customer. The program succesfully completed and it shows in the logfile that few documents got processed and few lines got processed. But the output file in the outbound directory shows the file size as zero.
    Can anyone please let me know what could be the problem.
    And please let me know how to check whether flatfile is generated succesfully for the request run for any customer.
    Thanks in advance.
    Satya

    Hi Venkat,
    As every one have already explained other points,in standard SAP there is no provision to determine as if the sales order is intercompany or not.
    But if you  want you can create a user status as normal sales order and intercompany sales order.So by checking the status at table level or in order you can determine if it is Intercompany or normal sales order.
    Best way is to create a different document type itself which will be exclusively used for intercompany orders.So it will be easy for reporting and tracking purpose.
    Reward points if useful
    Regards,
    Amrish Purohit

  • Please help I just accidentally deleted a very very important note from my "Notes" on my iPhone 4s.  How can I get it back? Is there a "Trash" file somewhere for deleted notes?  Thank you, Susan

    Please help I just accidentally deleted a very very important note from my "Notes" on my iPhone 4s.  How can I get it back?
    Is there a "Trash" file somewhere for deleted notes?
    Thank you,
    Susan

    Had you never backed up the phone before? When you saw the iTunes logo and cable, the device was in recovery mode. The data was already lost. The only way to recover from that is to restore the device, which will delete all of your data. You will only be able to restore to your last backup, whenever that was. Sorry this happened, but this highlights the importance of doing regular backups. The backup is the only protection you have against a problem like this.

  • How to find out web content files linked in folio through scripting

    Hi all,
    Please suggest me, how to find out web content files linked in folio through scripting.
    Regards,
    Moorthy

    @Moorthy – can you tell us a bit more? By mentioning "folio", I think you are referring to Adobe Digitial Publishing Suite (ADPS or short: DPS). If yes:
    1. Do you want to analyze Folio files *.folio and get the linked web content files?
    2. Or do you want to check an InDesign file with an overlay and check what files are linked as web content?
    3. Or something else?
    Where is your base problem?
    Packaging the InDesign files and copy/relinking the web content files after the packaging process?
    Uwe

  • My macbook pro keeps saying I have 450 gigabytes out of 500 that are used.  But when I look on finder there are no files that are anywhere close to that amount.  I went through and deleted files from my mac and now I only have 10 gs free

    My macbook pro keeps saying I have 450 gigabytes out of 500 that are used.  But when I look on finder there are no files that are anywhere close to that amount.  I went through and deleted files from my mac and now I only have 10 gigabytes of additional space free. My mac now says I have 440 gigs of other that is used. But does not make sense, do I have a virus?

    Since you have not identified the OS your MBP is using, these extract may or may not assist you.
    http://pondini.org/OSX/LionStorage.html
    http://pondini.org/OSX/DiskSpace.html
    You may also download from the Internet OmniDiskSweeper (free) and open it it will show all of the files on your MBP and the respective sizes.
    ciao.

  • How to find that which flat file is belongs to which application server?

    How to find that which flat file is belongs to which application server?

    Hi,
    Search im www.sap-img.com, you will get most of answers.
    Jogdand M B

  • Mac won't let me move files into a folder bc it THINKS there are duplicate files - but they're not

    Mac won't let me move files into a folder bc it THINKS there are duplicate files - but they're not. There are hundreds of what it thinks are duplicates. How can I get it to let me put them all into a folder and create unique names? If I do one file at a time, it gives me the option to keep both files. But not when I am moving hundreds at a time.

    A reply to an old problem, but I couldn't find this solution anywhere. I had the same problem when I moved my iTunes library to an external drive. As Apple recommends, I used File > Library > Organize Library > Consolidate Files to copy my music files from my overstuffed hard drive to the external drive. Copying went fine for a while, adding about two-thirds of my files to the new drive without incident. Then I got the big stop sign with the error message: "Copying files failed. The disk could not be read from or written to."
    This turned out to have nothing to do with either the hard drive or the external disk. I had a bad file in my music library that was shutting down the consolidation process. Unfortunately the error message says nothing about which file may be the culprit. All I could think to do was to go back to my original library in iTunes and sort by Artist, select all cuts with artists beginning with A, right click and select "Consolidate Files". Then do the same with B artists, etc. Proceeding this way, files resumed copying but when I got to the "S" selections, the consolidate process failed again. Then I selected smaller and smaller batches until the problem file was identified. Removed it from my library and then Consolidate worked fine through the rest of the library. Problem solved.
    I spent several days working through this; hope I can save someone else the time.

  • How to find Specfic Purchase Order is being edited or not

    Hi Friends,
    How to find Specfic Purchase Order is being edited or not.
    Thanks in Advance.
    Murali Krishna K

    Hi ,
             When you are creating or editing a purchase order the table T160
    has a field TRTYP which keeps a track or edit or create or display.
    *     Masked
    A     Display
    B     Edit
    C     Display from archive
    E     Single-item planning
    H     Add
    V     Change
    X     Initial transaction
    S     Standard parameter: normal mode
    U     Convert indiv. planned order
    L     Delete
    P     Planning file entry
    K     Copy reference
    D     Print
    Please reward points if useful.

  • Cp: com.apple.finder.plist: No such file or directory

    Hello,
    As the title suggest, I'm having a problem with cp.
    As the matter of fact, com.apple.finder.plist is inside the preferences folder but why "No such file or directory"?
    The-Universe:~ LS$ cp com.apple.finder.plist com.apple.dock.plist.bak
    cp: com.apple.finder.plist: No such file or directory
    I learnt this command-line form the "Mac OS X Server Introduction to Command-Line Administration Version 10.6 Snow Leopard", pg 38.
    Thanks!
    Cheers.

    I would suggest having a backup of your whole disk, and particularly of any critical files, before proceeding here.
    The the documentation is assuming that you're defaulted into the expected directory, and the path to the plist directory is discussed in the immediately previous section of the manual you're working with. If you're logged into the user you want to edit, the plist files are here: ~/Library/Preferences/
    So some of the bash-level commands that can be used here (and that you will want to understand) follow:
    ls ~/Library/Preferences/
    ls -alR ~/Library/Preferences/
    cd ~/Library/Preferences/
    ls
    ls com.apple.finder.plist
    cp com.apple.finder.plist com.apple.dock.plist.bak
    The specific error here appears to be that the default directory is not in the expected directory. That's what cp has indicated; that there's no file with the specified filename here. The current directory is what the pwd and cd commands will work with, too. See +man pwd+ and +man cd+ for details.
    The Unix layer is comparatively unforgiving, and it's easy to corrupt a disk with an errant command. And the manual you're reading isn't going to explain what are the basics of the Unix file system organization and the bash shell; that's assumed knowledge for that manual, and outside the scope of what that manual is going to be documenting. Do have a backup of your disk, and of your critical data.

  • How to delete a READ ONLY file from Directory

    Hi Friends,
    how to delete a READ ONLY file from Directory , file is in my system only.
    Please help me .
    note: its read only file.
    Thank you.
    Karthik.

    hI,
    try with this statement.
    delete dataset <datasetname>.
    this will definitely work.
    Regards,
    Nagaraj

  • HT1386 My iOS isn´t in device on the left hand, how can find it? or is it that is not connecting properly to the computer

    My iOS isn´t in device on the left hand, how can find it? or is it that is not connecting properly to the computer

    You need to update to 10.6.8 using Software Update.

  • How to find if Classic Withholding Tax is Active or Not

    Hi All,
    How to find if Classic Withholding Tax is Active or Not for a company code. It is a U.S. company code.

    Hello Kumar,
    You can use tcode SE16 and view V_T001_EXT to check if extended withholding tax is active or not, for each company code.
    or if you prefer, use SE16 and table T001. Field WT_NEWWT.
    If extended is not active, then classic is used.
    Regards.

  • How to find desktop background image file

    I am preparing an old PowerBook G4 laptop to be sold. I had previously lent it to a friend and I am selling it to another friend. The friend to whom I lent it asked me for the desktop image file so he can use it as his desktop on the Mac he owns.
    I shot that photo years ago and I can't find the original .jpg for it, so I am hoping that I can find the desktop version of it before I finish preparing my PowerBook for sale. I have searched everywhere, but that image file does not show up on the PowerBook.
    I figure that since I can see the photo when I am logged in, it must be somewhere, but where? I originally had it in iPhoto, but it was deleted from there at least two years ago. This PowerBook only has one account, so there's not a lot of places to look through.
    If anyone has any pointers on how to find an image file on a PowerBook running Mac OS X 10.4.11, please let me know.

    HI Stanely,
    Try going to System Preferences/Desktop&ScreenSaver. Click the Desktop tab. Now, go thru the folders listed there to see if the image shows up there. If it does, then go to Spotlight and type in the name of the folder where the image was. Spotlight will populate a list for you. At the top of the list click where it says: Show All. A pane will open. Look for the folder, then on the right click the little white circle with an "i" in it. That will give you the path to find the folder where the image resides.
    You can search Spotlight by typing in these extensions: jpg tiff png pict gif bmp psp that's another way to search for an image.
    Also, open a Finder window and look in the Sidebar on the left. Click where it says: Pictures. Might be in there also.
    Carolyn

  • How to find the right XML files

    Hi all
    I need to customize OBIEE according to the custommers needs,Is there any tool to find the xml source files where I can make the changes.
    Currently I'm using 'psoug' to edit the page source code , for example I want to modify those values:
    <tbody>
    <tr>
    <td class="XUISectionHeadingTitle">Columns</td>
    </tr>
    <tr>
    <td class="XUISectionHeadingText">
    Click on column names in the selection pane to add them to the request. Once added, drag-and-drop columns to reorder them. Edit a column's format, formula and filters by clicking the buttons below its name.
    and I don't find the xml file to update it.
    Anyone knows how I can find it?

    *(BIInstallDir)\OracleBI\web\msgdb\l_en\messages*
    Under this path you can find the list of XML files....
    These XMLs are named to indicate what type of info it contain..

  • How to find current init.ora file

    I have 2 issues:
    Issue 1:--
    I have some 4-5 init.ora file which are created by some other user and facing difficulties to find exact init.ora which is used by my oracle 9.2 database. same thing for spfile.
    Is there any way so that i can find the currently use init.ora file?
    Issue 2:
    I want to change init.ora file parameters for the oracle9.2(siebel).
    Presently default it is showing optimizer_mode=CHOOSE
    I have tried to change to RULE but not refelecting after database restart.
    at session level i can modify but i want permanent change and for thius i tried with
    user SYS as SYSDBA with
    ALTER SYSTEM SET optimizer_mode=RULE;
    but getting following Oracle erroe message
    ORA-02096 specified initialization parameter is not modifiable with this option
    Cause: Though the initialization parameter is modifiable, it cannot be modified using the specified command.
    Action: Check the Oracle9i Database Administrator's Guide for information about under what scope the parameter may be modified
    How we can make changes in init.ora file?
    Regards
    Junu

    As far as I know, there's no possible way to find out which parameter file was used to start instance. And, even if it was, I don't really see much sense in it because parameter file is a client-side file, and usually it required to start up Oracle instance remotely.
    In principle, parameter files are obsolete beasts, consider using server parameter file (SPFILE) instead. And, for SPFILE, it's pretty easy to find out its location:
    SQL> show parameter pfile
    NAME                                 TYPE        VALUE
    spfile                               string      %ORACLE_HOME%\DATABASE\SPFILE%
                                                     ORACLE_SID%.ORAAs for your ORA-02096 error, you have two opportunities to resolve it.
    If you decided to use SPFILE, create one (for example, using CREATE SPFILE FROM PFILE command), start your instance with SPFILE then issue:
    ALTER SYSTEM SET optimizer_mode=RULE  SCOPE = SPFILE;and bounce your instance.
    If you still wish to use old-style parameter file, you have to add corresponding setting into that file manually (it's a plain text file in fact) and restart instance.
    Regards.
    P.S.: Why do you want to enforce rule-based optimizer by the way?...

Maybe you are looking for