comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Spaces in Mac file names
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Spaces in Mac file names [message #83991] Sat, 13 April 2013 21:19 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/13/13 12:33 PM, Jeff N. wrote:
> On Saturday, April 13, 2013 1:30:22 PM UTC-4, kagol...@lbl.gov wrote:
>> Regarding spaces in Mac file and directory names: I know this is an old topic, but is there a generally accepted method, or a library function in someone's IDL library, to take a file name as input and output ac copy with the spaces escaped properly with backslashes?
>>
>>
>>
>> In other words, take
>>
>> /this/directory/has spaces/youknow.txt
>>
>> and output
>>
>> /this/directory/has\ spaces/youknow.txt
>>
>>
>>
>> I need this for a spawn command to work on arbitrary files. Thanks!
>
> I usually do this:
>
> ENVI> path = '/this/directory/has spaces/youknow.txt'
> ENVI> print, strjoin(strsplit(path, ' ', /extract), '\ ')
> /this/directory/has\ spaces/youknow.txt
>

Careful, multiple spaces won't be treated correctly. Use /PRESERVE_NULL:

IDL> path = '/this/directory/has spaces/you know.txt'
IDL> print, strjoin(strsplit(path, ' ', /extract), '\ ')
/this/directory/has\ spaces/you\ know.txt
IDL> print, strjoin(strsplit(path, ' ', /extract, /preserve_null), '\ ')
/this/directory/has\ spaces/you\ \ know.txt

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Previous Topic: Spaces in Mac file names
Next Topic: COST atmospheric correction IDL code

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 12:41:10 PDT 2025

Total time taken to generate the page: 0.56515 seconds