AppleScript Folder names with spaces

Hello,
I have been working on somethings in AppleScript and came accross one problem.
How do I remove folders that have spaces in their name.
The method I use is by using a terminal command as shown below.
do shell script "rm ~/Desktop/This is the folder/"
I would have come into an error saying
error "rm: /Desktop/This: No such file or directory
rm: is: No such file or directory
rm: the: No such file or directory
rm: folder: No such file or directory" number 1
I have tried Googling and found this.
do shell script "rm ~/Desktop/This\ is\ the\ folder/"
but have came up with this syntax error.
Expected “"” but found unknown token.
Please help me with this issue. If there is another method, without using the do shell script command, maybe telling Finder to delete the folder?, please suggest.

Neil gave the correct answer (though I would have used System Events to do the same thing).  But to address the problem you're having with the rm command...  In applescript the backslash character is an escape character.  It's used when you want to have literal quotes in a text string, e.g.
set txt to "Senator McCain said \"Nerf Balls!\" in a press conference yesterday."
Since the backslash is an escape character in applescript, you need to escape it as well if you want a literal backslash:
do shell script "rm ~/Desktop/This\\ is\\ the\\ folder/"
personally, I always single quotes where I can in do shell scripts because the double backslash looks weird, but...

Similar Messages

  • Windows 2003 - create folder name with yesterday's date

    Hello friends..
    please advise,
    I want to create folder name with yesterday's date and then move yesterday's date files to this folder...so for example;
    if today is 2014_07_17 then create folder as below (2014_07_16)
    d:\test\214_07_16
    then move all files extension .txt from d:\test\*.txt to d:\test\2014_07_17
    thanks in advance...

    These ones may help.
    Use PowerShell to Create a Bunch of Folders Based upon the
    Date
    Using the Move-Item Cmdlet
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • SQL Query not working for column names with spaces

    Hi People..
    We have a strange situation wherein, the column name in the database table has a space inbetween like "Constant Name". While we write a JDBC statement code with the select query we get an exception for invalid syntax. It will help us in a great way if you have anything to inform us on this..
    Thanks
    Prabz

    Using case sensitive names and names with spaces in it is not a good practice.
    However, I believe the SQL standard accounts for this with quoted identifiers. I believe the syntax is
    . select "My Field1", "My Field2"
    . from "My Table'
    Have also seen the following although it might be MS Access specific.
    . select [My Field1], [My Field2]
    . from [My Table]

  • Folder names with diacritics & NFS shares

    OK; sometimes things appear simple but are not. Sharing files with an OSX client has been, and is a nightmare in a Linux environment.
    We have a mostly Ubuntu environment and have tried Samba, and NFS. After a significant amount of work the Mac can do stable NFS Mounts provided the following unconventional settings are implemented:
    In the /etc/exports file on the Ubuntu server:
    /some/catalog/to/export 192.168.0.0/24(rw,sync,nosubtree_check,allsquash,anonuid=1000,anongid=1000,insecure)
    - anonuid needs to be user ID of the user on the server that is the owner of the catalog
    - anongid needs to be group ID of the group on the server that is the primary group for of the catalog
    On the Mac in Disk Utility/File/NFS Mounts:
    - Enter the correct paths
    - click "Advanced" and fill in: resvport,nolocks,locallocks,intr,soft,wsize=32768,rsize=32768
    This finally let's you mount the share
    However, after using the share for a while we discovered that folder names on the share that contains diacritic characters, including characters å,ä,ö and Å,Ä,Ö did not display in the file listing in Finder (In Path Finder Folder names are replaced with " -- "), nor could the folder be opened. However, right-clicking the " -- " in Path Finder and selecting "Get info" did display the correct path to the folder and did display the diacritic characters in the path correctly.
    In a catalog containing 264 folders that all had the same owner and the same group & permissions, 94 did not display properly in OSX/Finder and none could be opened. All 94 contained one or more diacritic characters (åäö or ÅÄÖ). None of the 170 others did contain any diacritics. Spaces, and e.g. "&" does not cause problems.
    With an Ubuntu client I can NFS mount the same server, and I do get the folder names displayed correctly and I can open the folders. It appears likely there is a bug in OSX - likely in Finder/Path Finder, since the correct path name is displayed in "Get Info".
    Message was edited by: TheSnowGirl
    Message was edited by: TheSnowGirl

    Gave up on this and downloaded Interarchy (RBrowser seems similar). This is not NFS and not Samba; rather FTP over SSH (SFTP). Secure, even for remote access and works out of the box, like breeze. All access rights intact . And there is a preview of file, rather that open on remote server...

  • Independent Servers?: Publishing and page names with spaces

    Hello I am hoping someone who has published their site to server independent of .mac could tell me how they managed to name their pages with spaces without publishing problems. I have read here that you have to use an underscore or something similar to name your pages....Eck....I am making a site for my mother's business and I would prefer to use page names like 'about our service' instead of 'aboutourservice'. And I have seen that some people have managed this. Can any kind souls help?
    Thanks!

    DJ.... I publish my site to FOLDER first, then upload
    it to my server using FETCH FTP. It loads fine and
    doesn't have trouble with the menu spaces and such.
    Not sure what everyone else is saying about that, but
    it's not an issue. I use .Mac for my podcasts, and
    iWeb at DreamHost for my internet site.
    Jim -- what's your url? I'm wondering if there are some hosts which automatically replace spaces in uploaded files. Normally you just can't upload them. Or maybe Fetch is doing it for you. Would be useful to know.

  • Bug in the copy cluster roles wizard - CSV reparse points cannot have names with spaces

    Hi All,
    I have identified a bug in the copy cluster roles wizard in 2012 R2, which is preventing me from migrating my clusters from 2008 R2 & 2012 to 2012 R2.
    The bug surfaces when you attempt to copy a VM role from a 2008 R2 or 2012 cluster that has a CSV reparse point name that contains spaces as follows:
    The role appears to copy across fine, but once you've migrated the CSV and brought it online followed by starting the VM, the VM configuration resource promptly fails along with the VM.
    The issue can be spotted inside the copy cluster roles wizard, where it presents itself by removing all text after the first space in the name to read "C:\ClusterStorage\CSV" rather than "C:\ClusterStorage\CSV
    Test Disk 3" as follows:
    The bug only appears for VMs on CSVs with a reparse point name containing spaces - all other scenarios succeed.
    After searching through the registry on the new cluster, you can clearly see that the VM role hasn't been correctly copied.
    It shows a value called SharedVolumeMappings with the data C:\ClusterStorage\CSV|<guid>|<integer>
    Whereas it should show the data C:\ClusterStorage\CSV Test Disk 3|<guid>|<integer>
    If you modify the data in the SharedVolumeMappings value in both
    0.Cluster\Resources\<VM guid> and Cluster\Resources\<VM guid> keys, the VM will start and work correctly.
    The problem for me is that I have many VMs on many different CSVs all with spaces in the names of the reparse point! Its not feasible for me to go through the registry for every copied VM on every node of the new cluster, as this would take a very long time
    and would be prone to errors that could cause further problems.
    Can anyone provide any help on this? A hotfix for the issue would be great, if anyone from Microsoft is reading :-)
    My deadline to get the VMs migrated to the new cluster is the 21st February, so I would really like to have a solution to the problem before then if at all possible.
    Many thanks in advance,
    Tom

    Hi Subhasish,
    Thanks for the reply, glad that its something that is reproducible!
    Do you have any idea of timescale? Or is it likely that I will have to modify the registry as above to get this working?
    If I am going to have to modify the registry, please can you let me know if the resolution I have tested above is safe and viable? Or are there other settings that I will need to change to make the cluster fully aware of the proper path to the CSVs for its
    VMs?
    Also, is there a known procedure for renaming the reparse point whilst VMs are running on it? This would allow me to negate the issue before copying the roles to the new cluster :-)
    Thanks again,
    Tom

  • Document library: File name with spaces at EOF

    I noticed a strange issue with uploading files with space at end of file (example "ABC  .xlsx"). Such files are allowed to be uploaded for the first time but when the end user (with contribute permission) tries to upload the same file again
    (overwrite) then it uploads the file and goes to the next dialog box where properties for the form is collected (EditForm) and then when user tries to hit save, he gets "Sorry this site is not shared with you" error. The owners (with Full control
    permission) get the error message that the file needs to be renamed. 
    This does not happen with files having proper names. The files are automatically overwritten as expected.
    Is it a SharePoint bug or am I missing something ?

    Hi Prakash,
    When we upload a document which contains spaces at the end of the file name, then SharePoint will trim out the spaces in the Edit Item Form, so the name for this document should be “ABC.xlsx”.
    When we re-upload the document to SharePoint, because of that extra space it sees the filename(ABC  .xlsx) as different to the existing document (ABC.xlsx) so it adds it as a new document.
    And in the edit item form, the space has been trimmed out. Because there is already a document with that filename in the document library, it throws the error.
    So this issue is by design that SharePoint uploads the document first and then edit the properties of the document.
    For more details, please refer to the link below:
    https://discoverlars.wordpress.com/2012/10/27/sharepoint-doesnt-overwrite-a-document-with-the-same-name-but-creates-duplicates/
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • Field names with spaces in target file using fcc

    Hello Friends,
    My target structure fields:
    MT_Target
    ItemNo, ItemName, ItemQuantity, AmountValue, TotalAmount
    My requirement here is - In the target file - these fields should be generated with space. Shown as below:
    Item No, Item Name, Item Quantity, Amount Value, Total Amount
    How can i achieve this.
    Thanx
    S.

    if i understood u correctly u want to have a header line in ut target file same as that ur field names but with a space in between??
    if yes  the use :
    NameA.addHeaderLine=3
    NameA.headerLine =Item No, Item Name, Item Quantity, Amount Value, Total Amount
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm

  • File download - file name with spaces

    I use the resp.setHeader("Content-disposition", "attachment; filename="+filename) method. it works. However, when the file name contains spaces the dowloaded file's name is only the part of the string up to the space, nothing more. Is there a way to deal with it? I'm replacing spaces for '_' at the moment but that's not exactly what I want.
    Thanks.

    Is the filename put in between quotes?
    resp.setHeader("Content-disposition", "attachment; filename=\"" + filename + "\"")

  • File name with spaces

    Hi,
      I am unable to upload files with file name having blank spaces to cFolders 4.0.
    Kindly help me to resolve this issue.
    Regards,
    Shynu John

    Hi Shynu,
    Please refer the following note.
    Note 959280 - File names with special characters are uploaded incorrectly.
    Regards,
    Pavan

  • Handling property name with spaces in SQL query

    Hello,
    I have some JSON that looks like this:
        "SystemId": "112234",
        "Parameter": {
            "Total Hours": [
                    "timestamp": "2015-03-15T15:20:00Z",
                    "itemValue": "0"
                    "timestamp": "2015-03-15T15:15:00Z",
                    "itemValue": "296"
    ..and am having trouble with the space in the "Total Hours" property name.  When executing a SQL query, I have tried to reference it as ["Total Hours"], [Total Hours], and "Total Hours", but none of these works.  I
    have also reviewed the "Querying DocumentDB" and "DocumentDB SQL Query Language" documents, but am unclear on how to escape this space.  As this is valid JSON, I would expect to be able to handle it via DocumentDB SQL query, but am
    not certain what I am missing.  
    Thanks for your help.
    Please remember to mark replies as answers if they help you.

    Given that the property with the name with the space contains an array, I attempted to query using:
     SELECT * FROM c WHERE c.Parameter.c["Total Hours"][0].timestamp = "2015-03-15T15:15:00Z" and a few other permutations, but no luck.  Did I misunderstand?
    Please remember to mark replies as answers if they help you.

  • Role names with spaces (6.1 to 8.1)

    Hi All
    I'm working in an organization that has group and role names within their LDAP
    repository such that the group and role names contain spaces. Hence, for example,
    within a web.xml file lines like the following exist:
    <role-name>Some Role Name</role-name>
    This has worked without problem in Weblogic 6.1 but given some prelimanary work
    within 8.1 we are noticing that Weblogic 8.1 does not appear to like spaces within
    the <role-name> element.
    Is this just the way it is with Weblogic 8.1? Or is there a way to continue to
    use role names with embedded spaces within Weblogic 8.1?
    Thanks,
    Rob

    "Peter" <PeterB> wrote:
    >
    "Rob" <[email protected]> wrote in message
    news:3f57d329$[email protected]..
    Hi All
    I'm working in an organization that has group and role names withintheir
    LDAP
    repository such that the group and role names contain spaces. Hence,for
    example,
    within a web.xml file lines like the following exist:
    <role-name>Some Role Name</role-name>
    This has worked without problem in Weblogic 6.1 but given some prelimanarywork
    within 8.1 we are noticing that Weblogic 8.1 does not appear to likespaces within
    the <role-name> element.
    Sounds like a bug. File a support case.
    Hi,
    A workaround exists :
    1 - in web.xml, update your role-name element by replacing spaces with "_"
    2 - in weblogic.xml, add :
    <security-role-assignment>
         <role-name>Some_Role_Name</role-name>
         <principal-name>Some Role Name</principal-name>
         </security-role-assignment>
    Regards
    Christophe

  • QT v10.0 "save for web" creates file names with spaces?

    I find it strange that the additional exported files from "save for web" (iPhone, etc) auto exports files with spaces in the file names. Not only that, but changing the file names breaks the javascript.
    I work on a server that denies permission to files with spaces in the file names. I know it's a bit archaic - but it's also a long standing tennent of "good HTML" to creates files with a hyphen or underscore instead of a space.
    Is this something that can be addressed in the next update?

    If your using cs5 or cs6 you might try Image Processor Pro which seems to use underscores
    and has a save for web option.
    Dr Browns Services 2.31
    http://www.russellbrown.com/scripts.html

  • XL Reporter - folder name with funny character

    Hi experts,
    I'm using SAP B12007A PL:30 and XL Reporter Version 8.0.13.
    When I try to start my xl reporter, all predefined folder names in Report Organizer change
    to funny character. For example, the predefined folder name of "Inventory" display as "B1_11_2304".
    Please advice. Thanks

    Hi,
    Kait Chong.
    once again you disconnect XL Report Add on in Add on Manager then you Connect XL Report. B1_11_2304".  this is Inventory ID. try to Uninstall XL Report and install XL Report Add on then it will show
    Dimensions are transaction data that has underlying tables (master data) in the SAP Business One database. For instance, if you have a transaction with the name of a sales person recorded, you can have an underlying Sales Employee table that holds more information about the sales person. Other examples of dimensions are: Financial Period, G/L Accounts, Business Partner, Warehouses, Items, Vendor and many more.

  • Smart collection and folder names with "_"

    I have problems when making Smart Collections based on folder names
    My folder name is 2009_11_20 Mist
    When I make a Smart collection with "Folder" Stars with 2009
    I get a lot of files
    When I change the  2009 to 2009_11 I get no files. Even when I make 2009_ I get no files
    When I change the 2009 to Mist and the "Starts with" to "Contains" again I get the desired files.
    When I change the 2009 to 2009_11 and the "Starts with" to "Contains" again I get no files.
    It seems that LR with Smart Collections cannot handle the "_" character???
    Who can help?

    It's a bug. The usual workaround is to use hyphen as the separator in your folder names instead of an underscore.

Maybe you are looking for

  • IOS 6.1.2 WIFI Issue with Iphone 4s

    SInce I updated my phone to ios 6.1.2 my wifi gets dropped or the button itself gets greyed out. I dont know what to do. Shuld wait for ios 6.1.3 or what? This is the first time i am facing such an issue.  Apple customer care is also not able to solv

  • How java application get certified from SAP.

    Hi, Please guide me to certified my java application by SAP. What steps, requirements, licences, fees etc. Please help. Regards Balveer Singh

  • QUESTIONS # 2 TIGER SYSTEM FOR BETTER PERFORMENCE.

    Is it true that the tiger system speeds up system by 50%? i running OSX. Anyone make the switch and have some feedback.

  • Deinterlace for Menus (in Photoshop, Motion, and DVDSP)?

    I have a slide show built as menus (people like their buttons, so i'm not using the built-in slideshow) and I'm not sure what settings to use in Photoshop for the Deinterlace filter. The options are: Eliminate: Even or Odd Fields? Create New Fields b

  • Error with creative cloud

    There is an error when I try to install PhotoShop CS6 with Adobe Application Manager: "download seems to be damaged". What can I do?