How to create a folder with spaces written in Java under Linux?

Hello,
I have a serious problem
I want to run a Linux command using a Java class with the runtime interface, there is a command to create a folder named eg "My Folder", with a space
For create the Unix command is easy to do either:
mkdir My\ Folder
or
mkdir "My Folder"
But how to translate this in Java, I tried with two commands :
Runtime.exec("mkdir My\\ Folder")
Runtime.exec("mkdir \"My Folder\"")
For example :
import java.io.IOException;
public class CreerDossier {
public static void main(String[] args) throws IOException {
Runtime runtime = Runtime.getRuntime();
runtime.exec("mkdir My\\ Folder");
runtime.exec("mkdir \"My Folder\"");
But it's still not working,
For runtime.exec("mkdir My\\ Folder") it creates two folders My\ and Folder
For runtime.exec("mkdir \"My Folder\"") it creates also two folders "My and Folder"
Are there solutions?
Thank you !

But my real problem is how to apply the chmod 777 on a folder containing spacesSo why not say so in the first place?
Runtime.exec ("chmod 777 My\\ Folder");Runtime.exec(new String[]{"chmod", "777", "My Folder"});
That is why I chose the example of mkdirYour reasoning on this point is incomprehensible. You wanted help with A so you asked about B. Just wasting time.

Similar Messages

  • How to create a folder with date each day?

    I've not used Automator, just once to "create" a workflow to create a new folder with a name; but what I want is this:
    Each morning at 12:01 am, a new folder to be created with the correct date as the name of the folder.
    So for tomorrow, Sunday 23 Nov 2008 at 12:01, I'd suddenly have a folder on my Hard Drive that would have the date like 23 Nov 2008 or 11/23/2008 or 23-11-2008 or similar.
    Then at the end of a week I'd have 7 of these; - but I can manually trash them-- I want to create these on my HD since I backup via SuperDuper! each morning (automatically) at 3:35 am (incremental backup to an external La Cie HD) and I want to know if was done, so by having a folder with the date on it I can open the external HD and if I see that that folder with the recent date is there, then I'm confident the BackUp was run.
    I have been able to create a workflow to create a folder in Automator, but not sure how to:
    1. Have the folder created automatically each day at 12:01
    2. How to have the folder label be the date
    Thanks for any comments or certainly any other work-around or other way to do this or similar.
    Regards, Steve

    Open the AppleScript Editor. Copy the following into it:
    set dt to date string of (current date)
    set mth to word 2 of dt
    set dy to word 3 of dt
    set yr to word 4 of dt
    set dtt to mth & " " & dy & " " & yr
    tell application "Finder"
    make new folder at alias "Macintosh HD:Users:username:Desktop:" with properties {name:dtt}
    end tell
    Amend the path with your Hard Disk name and username. Save as an application to anywhere suitable.
    In iCal, set up an event with a daily repeat and an alarm at the time you want it: under 'Alarm' choose 'Open file': then in the next menu which will appear change from 'iCal' to 'Other' and navigate to your script. Enter the date and time.
    Your folder will be created as required: iCal does not need to be running. This script gives the folder name as, for example, 'November 22 2008', but it's easy to amend the script if you want something a bit different - for example:
    property zro : ""
    set yr to year of (current date) as string
    set dy to day of (current date)
    set mt to month of (current date)
    set dyy to dy as string
    set nmm to the number of items in dyy
    if nmm is 1 then
    set zro to 0
    end if
    if mt is January then
    set mth to "01"
    else if mt is February then
    set mth to "02"
    else if mt is March then
    set mth to "03"
    else if mt is April then
    set mth to "04"
    else if mt is May then
    set mth to "05"
    else if mt is June then
    set mth to "06"
    else if mt is July then
    set mth to "07"
    else if mt is August then
    set mth to "08"
    else if mt is September then
    set mth to "09"
    else if mt is October then
    set mth to "10"
    else if mt is November then
    set mth to "11"
    else if mt is December then
    set mth to "12"
    end if
    set dtt to mth & "-" & zro & dy & "-" & yr as string
    tell application "Finder"
    make new folder at alias "iBook HD:Users:roger:Desktop:" with properties {name:dtt}
    end tell
    This gives the folder name as, for example, 11-22-2008. (The days will have leading zeros, if you don't want these just remove the references to 'zro'.)

  • How to create a Folder with CurrentDatewith Year(2014_02_14)

    Hi,
    By using Server Object Model, how to create folder in a list
    FolderName is :with CurrentDate with year in the format of (2014_02_14)
    Ex:2014_02_14
    Regards
    Tharak

    Use below code to create folder in SharePoint List
    //You can also use SPContext to get current list using (SPSite site = new SPSite(http://SP2013:1111))
    using (SPWeb web = site.OpenWeb())
    web.AllowUnsafeUpdates = true;
    SPList list = web.Lists["ListName"]; //enter name of list
    SPFolderCollection folders = web.Folders;
    string folderName = DateTime.Today.ToString("yyyy_MM_dd");
    SPListItem listItem = list.Items.Add("", SPFileSystemObjectType.Folder, folderName);
    list.Update();
    listItem["Title"] = folderName;
    listItem.Update();
    web.AllowUnsafeUpdates = false;
    for refrence: http://msdn.microsoft.com/en-us/library/ee572091.aspx
    Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer :)

  • How to create a folder (with subfolders) with Applescript

    Good afternoon,
    Filemaker has the ability to ake use of AppleScript.
    From within Filemaker I want to create a new folder (with the name of a FileMaker field) that holds 6 subfolders.
    I am a complete noob where it comes to Applescript.
    This is my script so far:
    tell application "FileMaker Pro Advanced"
    set folder_name to cell "FolderName" of current record
    end tell
    tell application "Finder"
         activate
         make new folder at folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:folder_name}
    end tell
    tell application "Finder"
         activate
            make new folder at folder {name:folder_name} of folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:"subfolder"}
    end tell
    My problem is: the creation of "Subfolder1"
    What is my mistake there?
    Help is much appreciated
    Dick
    Ps: I need to make 6 subfolders there

    When you crate a new folder you can define various properties, but when refering to the folder just use the name, for example:
    make new folder at folder folder_name of folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:"subfolder"}
    Note that the result returned from making a new folder is a reference to that folder, so you can also do something like:
    tell application "Finder"
      set newFolder to (make new folder at folder "Desktop" of folder "dick" of folder "Users" of startup disk with properties {name:folder_name})
      make new folder at newFolder with properties {name:"subfolder"}
    end tell

  • How to create a folder with java application?

    Hi expert
    I would like to read some tutorial or manual to understand the logic behind the management of the folder and document from a java application in KM.
    Anyone could help me?
    thank you
    Andrea

    Dear Andrea,
    Please have a look to below documents might help.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30a2a087-190f-2d10-07a4-dad666b44c1f?QuickLink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/Snippets/KMLibrary-ReusableComponentforWebDynpro+Java
    Best Regards,
    Arun Jaiswal

  • How to create a folder with standard contained folders and files in SharePoint 2013?

    I've got folders and files on my SharePoint 2013 site that form a template when I add a new folder for a customer. When I create a new folder for a customer, I want those folders and files added automaticly to that new folder. How can I do that?

    How would I go about doing this without Visual Studio? Is that possible? Need to create Folder templates.
    Every "new folder" created should have nested folders already included. 
    Company Name (New Folder 1) 
    Company Documents (1.01)
    Tax Documents (1.02)
    Bank Statements (1.03)
    Extreme novice, please give as much details as possible! I'm trying to implement SP 2013 without all the 2013 software (Visual Studios, SharePoint Designer, etc.)
    Thank you!

  • How to create a folder with the name = date (e.g. "20030512") with LV6.0

    hi,
    i want to create folders with the name = date automaticly.
    i found several solutions here, but all in LV6.1. could somebody give me an example in LV6.0 ?
    I tried it with "get date-string" but that date-string has "." in it :-(
    6.1-example :
    here

    Hope this will help!
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com
    Attachments:
    folder_create_2003.vi ‏66 KB

  • HT4236 (PC) When I sync a folder of photos, they sync to the generic photo library on my iPhone, but it creates another folder with duplicates of the pictures. How do I prevent/get rid of this second folder?

    (PC) When I sync a folder of photos, they sync to the generic photo library on my iPhone, but it creates another folder with duplicates of the pictures. How do I prevent/get rid of this second folder?

    Um... that does not contain "duplicates".
    It's just a view that shows you everything that's in your other albums and events in one place...

  • How to create the folder in presentation server through pop-up(

    Hi Experts,
    Can u give me the solution , how to create the folder in presentation server through pop-up(means dynamically, after executing the program , pop-up has to come to create the folderand path)
    regards
    ram.

    Use the methods -> DIRECTORY_BROWSE & DIRECTORY_CREATE of the class CL_GUI_FRONTEND_SERVICES
    DATA: path TYPE string,
          rc TYPE i,
    dir_name TYPE string value 'HI'.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE
        CHANGING
          SELECTED_FOLDER      = path
      IF SY-SUBRC <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    concatenate path '\' dir_name into path.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
        EXPORTING
          DIRECTORY                = path
        CHANGING
          RC                       = rc
      IF SY-SUBRC <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Edited by: Kartik Tarla on Sep 23, 2009 5:54 PM

  • How to create a wiki with iWeb ?

    Hi !
    Any idea about how to create a wiki with iWeb ?
    I want to make a school web page but, instead of doing it myself, I thought it would be more interesting to make every student contribute - that's the point of making a wiki ! Could anyone help me ?
    Many thanks !
    Cheers.
    Chris.

    I know Apple's tools are VERY compelling and tremendously cool to use, but, given the collaborative nature of this endeavor, you may want to look at some internet enabled tools that, by their nature, allow many users to update the content from anywhere.
    Currently, if you're editing a page in iWeb, the information for that site is kept in the domain.sites folder. For several people editing the site, you would have to shuttle this file back and forth between all the users. If user A is currently editing the site, user B would have to wait until they're finished to get the file. If user A wants to make some changes, they'd have to wait until user B sends the file back to them and we haven't even got to the point of letting user C, D, or E have access to the content in order to make updates!! Add everyone else in the school and you would have to make sure this one file makes it across tens of computers without becoming corrupted and making sure that only one person is making changes at a time. This would limit the number of updates that can be handled on a regular basis (what if user M gets ill before handing it off to user N, now NO one can make updates until user M remembers where they left the content... if they didn't erase it).
    However, if you're willing to severely limit the scope of what a wiki is, then you can get input from everyone and enter it with just a few users that have access to edit the content.

  • How to create a folder to store my mail?

    hi,
    can u tell me how to create a folder to store my outgoing mails using java mail.
    Million Thanks for u
    With luv
    kathir

    hi chiru,
    Thanks for ur reply.Can u tell me how to configure IMAP.I've tried to configure IMAP in outlook and then i run the program with the code u sent,but it throws
    " javax.mail.NoSuchProviderException: No provider for IMAP
    at javax.mail.Session.getProvider(Session.java:289)
    at javax.mail.Session.getStore(Session.java:363)
    at javax.mail.Session.getStore(Session.java:343)
    at MessageSend.main(MessageSend.java:61)
    Plz give me some soln for this excep.
    Thanks in advance
    Regs
    Kathiravan

  • HOW TO CREATE SEVERAL folder for the generation and READING FILE

    HOW TO CREATE SEVERAL folder for the generation and READING FILE WITH THE COMMAND utl_File.
    please give an example to create 3 folders or directories ...
    I appreciate your attention ...
    Reynel Martinez Salazar

    I hope this link help you.
    [http://www.adp-gmbh.ch/ora/sql/create_directory.html]
    create or replace directory exp_dir as '/tmp';
    grant read, write on directory exp_dir to eygle;
    SQL> create or replace directory UTL_FILE_DIR as '/opt/oracle/utl_file';
    Directory created.
    SQL> declare
      2    fhandle utl_file.file_type;
      3  begin
      4    fhandle := utl_file.fopen('UTL_FILE_DIR', 'example.txt', 'w');
      5    utl_file.put_line(fhandle , 'eygle test write one');
      6    utl_file.put_line(fhandle , 'eygle test write two');
      7    utl_file.fclose(fhandle);
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> !
    [oracle@jumper 9.2.0]$ more /opt/oracle/utl_file/example.txt
    eygle test write one
    eygle test write two
    [oracle@jumper 9.2.0]$
    SQL> declare
      2    fhandle   utl_file.file_type;
      3    fp_buffer varchar2(4000);
      4  begin
      5    fhandle := utl_file.fopen ('UTL_FILE_DIR','example.txt', 'R');
      6 
      7    utl_file.get_line (fhandle , fp_buffer );
      8    dbms_output.put_line(fp_buffer );
      9    utl_file.get_line (fhandle , fp_buffer );
    10    dbms_output.put_line(fp_buffer );
    11    utl_file.fclose(fhandle);
    12  end;
    13  /
    eygle test write one
    eygle test write two
    PL/SQL procedure successfully completed.
    SQL> select * from dba_directories;
    OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
    SYS                            UTL_FILE_DIR                   /opt/oracle/utl_file
    SYS                            BDUMP_DIR                      /opt/oracle/admin/conner/bdump
    SYS                            EXP_DIR                        /opt/oracle/utl_file
    SQL> drop directory exp_dir;
    Directory dropped
    SQL> select * from dba_directories;
    OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
    SYS                            UTL_FILE_DIR                   /opt/oracle/utl_file
    SYS                            BDUMP_DIR                      /opt/oracle/admin/conner/bdumpRegards salim.
    Edited by: Salim Chelabi on Apr 4, 2009 4:33 PM

  • How can I merge folder with the same name so that the content does not replace the other

    How can I merge folder with the same name so that the content does not replace the other?

    >
    That's only a good idea if the semantics of sayHello
    as defined in MyInterface suggest that a
    RemoteException could occur. If not, then you're
    designing the interface to suit the way the
    implementing classes will be written, which smells.
    :-)But in practice you can't make a call which can be handled either remotely or locally without, at some point, dealing with the RemoteException.
    Therefore either RemoteException must be part of the interface or (an this is probably more satisfactory) you don't use the remote interface directly, but MyInterface is implemented by a wrapper class which deals with the exception.

  • How to create new folder on laundchpad?

    How to create new folder on launchpad? I am new, sorry

    Hi Amauri17,
    Launchpad works just like iOS if you're familar with the folder structure. Click, hold and drag one application onto another and it'll group them into a folder.

  • How to create shared folder between mac and windows

    how to create shared folder between mac and windows

    Us ean external drive formatted FAT32 or ExFat. Both OSx and Windows can read/write to the drive and both can use the same data files as long as you have a program that can open and save these files. For example, Word running both on OSx and on Windows will be able to work with the same document on the external drive.

Maybe you are looking for

  • How to set default Web Template for BEx Query iViews in BI Portal?

    Hi, 1) In SPRO you can set the Standard Web Template used, e.g. ZANALYSIS_PATTERN1. 2) I published a query to Portal and when it runs within Portal, I want it to use a different web template, say ZANALYSIS_PATTERN2. I don't want to change the BEx Web

  • HT3529 My icon is gone how do I get it back

    How do I get my message icon back

  • Issue with Crystal Report Server

    Hi, I have a .Net application that uses Crystal Reports Server. The application runs from two servers through load balancing and one of them hosts RAS(Report Application Server) component as well. The issue I am facing is that the server that does no

  • Relationship between 2 lists

    Hello there, I have sample question about SharePoint 2013. I would like to know how I can make a relationships between two lists in SharePoint. Here an example about what I want, The fires list is an information about the building. This list includin

  • Problem in displaying Thai fonts after migrating from Reports 2.5 to 6i

    Hi, We have recently migrated our reports from Reports 2.5 to 6i. When we were using Reports 2.5, we could display The Thai Fonts correctly, but after migrating to 6i, the data retrieved from database is being displayed as junk characters. In Reports