Create File with Folder

Dear sir,
i wrote small Generic API for create a file*(test.txt)* or folder*(..\folder\test.txt)* with a file......
1. The Generic API successfully executed when i passed a file...
2. when i pass folder with file name it throws Exception in thread "main" java.io.IOException: The system cannot find the path specified
     at java.io.WinNTFileSystem.createFileExclusively(Native Method)
     at java.io.File.createNewFile(Unknown Source)
     at com.vs.accr.xmlObjects.TestClass.main(TestClass.java:11)please help me out.....
Thank you
Boss134

      * strFileWithPath may handle 2 type of input . those are
      * 1. file Name (test.txt)
      * 2. folder Name with file Name   (..\sample\test.txt)
      * @param strFileWithPath
     final public void createFile(String strFileWithPath)
          File file = new File(strFileWithPath);
                file.createNewFile();
     }i tried mkdirs() API - it generates 2 folder (sample and test.xml)
Thank you
Boss134

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

  • Macro to create file in folder no longer works.  Help in fixing, please.

    I switched from PC to Mac. I have Xcel files with Macros. The macros create a file and save it to c:\my documents\wherever the macro tells it. That is in Xp.
    Now I need to run these Macros and create these files and save them on the Mac HD Documents folder in whatever directory the macro is set to.
    Anyone offer any help?

    The path should be either ~/Documents, or the full path of /Users/<your user name>/Documents. Don't know anything about excel macro's so I'm no help there.
    My only question is why you have this macro in the first place. You could just save the file and whenever you make changes and save them it will be saved to the same spot.

  • How to check In a file with folder structure

    Hi,
    Is it possible to check in "a file with its complete folder structure".
    For Ex: folder A contains Folder B and B contains a file , Then is there an option to check in the file in content server with the same structure A-->B-->file.
    Thanks In advance.

    JRS, this will copy ALL the files and folders from folder A to the content server.
    If he only wants to copy file A that is inside folder B than your way is somewhat overkill unless you are sure that the file is the only one in the complete structure but that i doubt...
    I haven't checked it before but perhaps someone can tell if this is possible...
    If you check in a file, perhpas you can get the original file and foldername from the metadata. If this is possible, you can create your own code that hooks on the check in and then create a directory or just move the file in the directory.
    I have written such a component but it's based on some custom metadata we use, not on the original filename.
    If i find the time, i will try some things and tell you if it works

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

  • Premission settings for users creating files and folder on my XServe

    I am setting up a new Xserve and we are basically using it as a file server. I have a user that logs on creates and new folder and a file. When any one else opens that file it is READ ONLY. What do I need to do to make it so when any of my users create a file or folder on the server any one of my users can have READ/WRITE permission to the files?

    Can you elaborate?  I am not aware of any m3u playlist being present but maybe there is.  I have done this many times before.  I move tons of files around in my music folder, add/delete/change, and rather than have iTunes try to figure it all out again, I just remove everything out of iTunes and add my entire folder back.  I've done it probably 50 times in the past and now, when I do it, it's creating playlists for every single folder or album or something, just as the original poster has described.  I do not like the behavior and would like to turn it off now!  I'm on Mac so iTunes Folder Watch will not work for me.  Any suggestions?

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

  • 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) ;
    }     

  • Create file or folder

    could anyone direct me to some resources/examples about how to manipulate files/folders, i need to write a shell program to create, move, delete folder or files.
    many thanks!

    Check out the File API (folders are just special type of file)
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
    You might also search the forums for answers. Like so
    http://onesearch.sun.com/search/developers/index.jsp?qt=%2Bcreate%2C+%2Bmove%2C+%2Bdelete+%2Bfolder+%2Bfiles&col=devforums

Maybe you are looking for