Create file with subdirectories? (Unzip)

Hi, when following the example to unzip the contents of a zip file (http://developer.java.sun.com/developer/technicalArticles/Programming/compression/
), it fails when the files are situated in subdirectories.
So there is no way to create a file in not yet existing subdiretories directly? I'll have to parse the filename and create non-existing directories, or is there another, simpler way?
Thanks
Heiko

use mkdirs().. it'll create all dir and subdirs..
import java.io.*;
class  CreateDir
     public static void main(String[] args) throws Exception
          File f = new File("C:/ram/code/dir/test/xyz/abc");
          f.mkdirs();
          System.out.println("Hello World!");
}regards
raamam

Similar Messages

  • How to create file with APDU

    Hello everybody,
    It's my first time using Java Card ^_^,I want to create a file and fill the fill with binary data.but i don't know how to create file with APDU commands,so I need help here.
    I think that there must be a Manual of the JavaCard's OS in this world,can someone tell me where to download it??
    Thanks.
    the fllowing is my card:
    Samsung S1
    Model:TiEx-32J
    EEPROM size:32k
    Platform Version:OP 2.0.1
    Card Manager Status:OP_READY
    KMC:40~4F/No derivation
    Message was edited by:
    AllenHuang

    If you look around the forum for a bit, you will see that there is no notion of file systems on JavaCards (lexdabear posted this information less than two hours ago :-)). To store files, you will have to write an applet to hold byte arrays of the required size and handle receiving and sending of these.
    As for documentation, you should have a look at the GP (General Platform) specification at http://www.globalplatform.org/, which defines communication between smart cards and other devices, as well as Sun's own JavaCard pages (http://java.sun.com/products/javacard/), which contain several useful resources on JavaCards.
    Message was edited by:
    Lillesand

  • Create File with header

    Hi all,
    We have requirement to send data to FTP server,
    am able to send data to FTP server, but the problem is am not able to send file with Header,
    Eg:
    oreder numer    netvalue   discount   Grossamount
    90000909          2323.34    343.33      4545.000
    90000909          2323.34    343.33      4545.000
    90000909          2323.34    343.33      4545.000
    i have to send the file in the above format.
    plz guide me hoe to create file with above format?
    REgards,
    DS kumar

    Hi,
    Use the following code to create header.
        DEFINE add_field_header.
          clear &1.
          &1-field = &2.
          append &1.
        END-OF-DEFINITION.
        add_field_header heading 'oreder numer'.
        add_field_header heading 'netvalue'.
        add_field_header heading 'discount'.
        add_field_header heading 'Grossamount'.
    In GUI_DOWNLOAD pass heading to Fieldnames parameter.
    Regards,
    Ni3

  • How to create files with read/write privileges for everyone?

    I have two iMacs 7,1 (one with Snow Leopard and the other with Mountain Lion) in a local area wireless network.
    I have shared the "documents" folder in the Snow Leopard iMac in order to have files available to the other iMac. The folder has read/write privileges for everyone.
    When I create a new file in the shared "Documents" folder (for example a new Open office document, or a Keynote presentation) this file is by default "read/write" for the Administrator but only "read" for all the other users, so when I try to open it from the other iMac, I am informed that the file is "read only".
    I can obviously change the privileges of the file in the information window, but I have to do on a file per file basis and this takes too long.
    Is it possible to change settings in order to create files which are always "read/write" for everyone?
    And, secondly, since I have several existing files whose privileges I should manually change one by one, is it possible to make global changes of their privileges?
    Thanks in advance
    Best regards

    couple of different changes - 1st, if you want to share folders, doing your whole documents folder is not the best way.  Since both your computers can handle AidDrop, that's what I would recommend - http://osxdaily.com/2011/11/14/how-to-use-airdrop-in-mac-os-x/ - as it create an instant Ad-Hoc network between the two computers and then let's it done. 
    A second possibility that may not be what you're looking for, is to use google drive or some similay cloud sharing app to sync the documents back and forth.  both of these solutions will transfer the files well, but the airdrop may be simplest

  • [File] Problem while creating files with long pathnames

    Hello everybody
    I'm trying to create File objects corresponding to physical files. These files have very long pathnames because they are located in directories tree with large depth. So, my pathname conatins a lot of directories plus the name of the file itself.
    It seems, that there is a limitation in the length of the pathname that I pass to the File constructor because files with small pathnames are OK bu the ones with very large pathnames cannot be created.
    I tried the different File constructors (File(String pathname) and File(File parent, String childname)) but it still does not work. Even if the second constructor is a little bit better as it succeeds on files where the first constructor failed. But still, it's not enough.
    Please Help!
    Thank you
    Hugo

    RESOLVED!
    The problem was from the OS itself (Windows XP) which accepts at most 255 characters long path names.

  • Transfer file clean up: What is best practice when creating files with timestamps?

    Created an SSIS package to create files that will be sent which are created with a time stamp. What is the best procedure of clean up for the files? I'd like to keep at least a day of files for verification purposes.

    Run http://filepropertiestask.codeplex.com task to get the file creation date and if older delete it or a Script Task that uses the .Net FileInfo
    CreratedDate method to find it Then you can use
    Precedence Constraints to either skip the file deletion or not.
    Arthur
    MyBlog
    Twitter

  • NFS4: Allow client to create files with arbitrary uid and/or gid

    Hello.
    I've got a ZFS, which is supposed to be used for storing backups of client machines. I've set:
    --($ ~)-- zfs get sharenfs data/backup/winnb000546
    NAME                     PROPERTY  VALUE                                                 SOURCE
    data/backup/winnb000546  sharenfs  ro,root=winnb000546:10.0.4.5,rw=winnb000546:10.0.4.5  localOn winnb000546, I can then mount and access this directory. "root" can also create files (eg. "sudo touch $mountpoint/file") and this file is then owned by root:root (0:0).
    But this directory is supposed to hold a backup of the client machine; we don't use NIS or LDAP and thus /etc/passwd and /etc/group don't match. As winnb000546 is a Linux system (Arch Linux, to be exact), it would be somewhat hard to set it up so, that passwd/group completely match anyway.
    Now, as said, it's supposed to be for backup and thus I need to retain the ownership information exactly as it was on the client system. But it doesn't work...
    --($ /mnt/server/data/backup/winnb000546)-- sudo touch file
    --($ /mnt/server/data/backup/winnb000546)-- sudo chgrp hal file
    chgrp: changing group of `file': Invalid argument
    --($ /net/winds07-bge0.win.ch.da.rtr/data/backup/winnb000546/oink/UIDs/nfs3)-- getent group hal
    hal:x:82:askwarIt failed, because the Solaris server doesn't have a group with gid 82.
    What do I need to do on the Solaris 10 server, so that it allows the client to create files on the NFSv4 export with arbitrary gid and/or uid values (ie. even with values it knows nothing about)?
    Regards,
    Alexander

    Mount it as NFSv3

  • Subsembly create file with apdu

    I am using subsembly sc api with APDU commands... i have problem with creating file:
    CardCommandAPDU aSelectAPDU = new CardCommandAPDU(0x00, 0xE0, 0x00, 0x00, 3750);
    I read in manual to create file, and it only said that i have to use
    E0, for other arguments it didnt say nothing... so what do i put for
    p1, p2 and cla nad send data?
    I used just size and i got this back:
    SW1:6B
    SW2:00
    It means that p1 or p2 is invalid! So what should i do? help

    Hi boss-tech,
    It appears that this question can better be answered by someone on one of the newsgroups for Windows Mobile or Windows CE. In order to get a quicker and more accurate response, please consider reposting this question to one of the following newsgroups:
    Windows Mobile API:
    microsoft.public.pocketpc.developer
    microsoft.public.smartphone.developer
    Windows CE API:
    microsoft.public.windowsce.embedded
    General programming (not VisualStudio related):
    microsoft.public.windowsce.app.development
    Native compilers:
    microsoft.public.windowsce.embedded.vc
    ActiveSync:
    microsoft.public.pocketpc.activesync
    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Create File with permissions

    Currently when I create a file on our Solaris 7 server it creates it with this:
    -rw-r--r--   1 jones  abcd           0 Jul 25 14:46 datafilePlease advise how I can change it so everytime I create a file it will be with these permissions:
    -rw-rw-r--   1 jones  abcd           0 Jul 25 14:46 datafile

    Actually, what you need to set your umask to, depends on the rest of the system.
    First check in /etc/default/login for the system wide UMASK setting. This is the one that applies to you. You should start calculating from there :)
    See also:
    ====================
    The three
    octal digits refer to read/write/execute permissions for
    owner, group, and other, respectively (see chmod(1),
    chmod(2), and umask(2)). The value of each specified digit
    is subtracted from the corresponding ``digit'' specified by
    the system for the creation of a file (see creat(2)). For
    example, umask 022 removes write permission for group and
    other (files normally created with mode 777 become mode 755;
    files created with mode 666 become mode 644).
    ====================
    Message was edited by:
    Cailin_Coilleach

  • Create File with access

    I'd like to create a file with just a specific property: enable to read but not to write.
    How can i manage?
    Thank for your help.

    I work under windows 2000.
    Is it possible for my application to modify a file "fic.txt" of six lignes only and give the file the read only mode.My problem is: the java application create the file with read only mode and doesn't want to write on it?
    If i 'm not clear sorry , here is my source code:
    public void Ecrire_Fichier(String parametre,String commentaire)
    try
    boolean bool ;
    File output = new File(this.get_Nom_Repertoire(),this.get_Nom_Fichier()) ;
    output.createNewFile() ;
    output.setReadOnly() ;
    if (!output.isFile())
    System.out.println("La cr�ation " + output.getPath() + " a �chou�.") ;
    return ;
    if (this.NombreLigne_Fichier()>=6)
    bool = false ;
    else
    bool = true ;
    BufferedWriter out = new BufferedWriter(new FileWriter(output.getPath(),bool)) ;
    out.write(parametre) ;
    out.write(" : ") ;
    out.write(commentaire) ;
    out.newLine() ;
    out.close() ;
    catch (IOException e)
    System.out.println("Erreur d'ecriture du fichier" + e) ;
    }     

  • Cannot create file with Non-latin characters- I/O

    I'm trying to create a file w/ Greek (or any other non-latin) characters ... for use in a RegEx demo.
    I can't seem to create the characters. I'm thinking I'm doing something wrong w/ IO.
    The code follows. Any insight would be appreciated. - Thanks
    import java.util.regex.*;
    import java.io.*;
    public class GreekChars{
         public static void main(String [ ] args ) throws Exception{
              int c;
              createInputFile();
    //          String input = new BufferedReader(new FileReader("GreekChars.txt")).readLine();
    //          System.out.println(input);
              FileReader fr = new FileReader("GreekChars.txt");
              while( (c = fr.read()) != -1)
                   System.out.println( (char)c  );
         public static void createInputFile() throws Exception {
              PrintStream ps = new PrintStream(new FileOutputStream("GreekChars.txt"));
              ps.println("\u03A9\u0398\u03A0\u03A3"); // omega,theta,pi,sigma
              System.out.println("\u03A9\u0398\u03A0\u03A3"); // omega,theta,pi,sigma
              ps.flush();
              ps.close();
              FileWriter fw = new FileWriter("GreekChars.txt");
              fw.write("\u03A9\u0398\u03A0\u03A3",0,4);
              fw.flush();
              fw.close();
    // using a printstream to create file ... and BufferedReader to read
    C:> java GreekChars
    // using a Filewriter to create files  .. and FileReader to read
    C:> java GreekChars
    */

    Construct your file writer using a unicode format. If
    you don't then the file is written using the platform
    "default" format -probably ascii.
    example:
    FileWriter fw = new FileWriter("GreekChars.txt",
    "UTF-8");I don't know what version of FileWriter you are using, but not that I know of take two string parameters. You should try checking the API before trying to help someone, instead of just making things up.
    To the OP:
    The proper way to produce a file in UTF-8 format would be this:
    OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream("filename"), "UTF-8");Then to read the file, you would use:
    InputStreamReader reader = new InputStreamReader(new FileInputStream("filename"), "UTF-8");

  • File-Adapter create Files with length 0

    Hello Guys,
    the XI get messages from the Backend via RFC and when the File-Adapter writes the Message sometimes with length 0
    Can you help me

    Hi Anton,
    As Sudhir mentioned, there could be a problem of correct data. The best solution is :
    Inside your RFC code just validate the code for empty values. e.g
    IF NOT ITAB_RFC[] IS INITIAL.
    **ITAB_RFC internal table data.
    ENDIF.
    and after validating this, if still you are getting some file with "0" length, then check File Content Conv in your CC.
    Regards,
    Sarvesh

  • File Adapter creates file with old record.

    Hi,
    I am working on Oracle Soa suite and trying to find out the the ways to Write file with the help of File Adaptor. But I find a problem with the file Adaptor that whenever I try to write updated rows to the file, it provides the earlier values in the rows and the new values are not written to the file.
    Regards
    Udit

    Hi Anton,
    As Sudhir mentioned, there could be a problem of correct data. The best solution is :
    Inside your RFC code just validate the code for empty values. e.g
    IF NOT ITAB_RFC[] IS INITIAL.
    **ITAB_RFC internal table data.
    ENDIF.
    and after validating this, if still you are getting some file with "0" length, then check File Content Conv in your CC.
    Regards,
    Sarvesh

  • Ls shows ??.html after creating file with arabic name using java applicatio

    Hi,
    I have a java application which is taking attachments and saving to the file system. when somebody attaches any file with the file name in arabic, the ls command shows ??.html , ????.html etc. The application is also not able to find the file later, cos it expects the arabic named file. How can I accomplish this task (" how can i rename a text file with an arabic name")
    Any help would be highly appreciated
    Many thanks in advance
    Ushas Symon

    I found a sample class that also uses HttpServlet and it won't work on my computer Either:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class Circle extends HttpServlet
        public void doGet(  HttpServletRequest request,
                            HttpServletResponse response)
                                throws ServletException, IOException
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println( "<BODY><H1 ALIGN=CENTER> Circle Info </H1>\n");
            try
                String sdiam = request.getParameter("diameter");
                double diam = Double.parseDouble(sdiam);
                out.println("<BR><H3>Diam:</H3>" + diam +
                "<BR><H3>Area:</H3>" + diam/2.0 * diam/2.0 * 3.14159 +
                "<BR><H3>Perimeter:</H3>" + 2.0 * diam/2.0 * 3.14159);
            catch ( NumberFormatException e )
                out.println("Please enter a valid number");
            out.println("</BODY></HTML>");
    }As for IE I tried setting all of my security to the lowest settings I have but it didn't work. I just noticed though that the IE explorer bar at the bottom states :
    Exception null.
    When the applet is first started. Not sure what to make of that.
    I don't think it's a dependancy error because when I make a reference to something that the compiler can't find I get a different error. Or if I miss importing something it just refuses to compile.
    I'm wondering if there's something wrong with my Java or the Servlet classes?
    Thanks
    Ga'an djin

  • Create file with URL

    Hi,
    I want to create one file. It is ok when i give hard coded path like "C:\Temp..." but i do not want this way - can i specify the file path as URL ?
    I am having a Constants file - where base URL is being stored as variable "localhost:8080". I want to create file in localhost:8080/documents/ folder.
    how can i do that ?
    regards
    Manisha

    HTTP does not support the creation of a file.
    You need to know the root directory and have access to it.
    e.g. say the too directory is C:\MyWeb , to write to localhost:8080/documents/ folder. you need to write to C:\MyWeb\documents\folder\

Maybe you are looking for

  • Unable to close web page using Safari 7.3.1

    Doing research and opened a page that required my name and password.  No idea what's going on and unable to close page even after force quitting Safari and restarting computer.

  • I need to replace my late 2006 20" imac hard drive

    here's what i have VIN,IMAC (20-INCH LATE 2006) running leopard 10.5.8 Hardware Overview:   Model Name: iMac   Model Identifier:    iMac5,1   Processor Name: Intel Core 2 Duo   Processor Speed: 2.16 GHz   Number Of Processors: 1   Total Number Of Cor

  • Forum registration question does not work if DST is enabled

    The forum software didn't accept my output of date -u +%V$(uname)|sha256sum|sed 's/\W//g' until I deselected "Daylight Savings Time is in effect (advance time by 1 hour).". I guess this is a bug, right? Or is it a way to keep users off this forum who

  • How do I change a cell to display values in Scientific Notation?

    I have to display values that are around 0.00000000225000000 How do I get these cells to automatically display as 2.25x10^-9 ? (or 2.25E-9) I can only find forums for how to disable. Thank you!

  • Something's wrong when I sync

    I have an 8g ipod touch (2nd gen). Lately syncing it is taking FOREVER. For some reason, it is copying over about 550 of the songs that are on the ipod whenever I hook it up to my computer (even though they're already on the ipod). When you look at t