Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > filenames with spaces

filenames with spaces
Thread Tools
Junior Member
Join Date: Feb 2000
Location: Chicago, IL
Status: Offline
Reply With Quote
Oct 13, 2000, 10:37 PM
 
OK, I'm not completely stupid. I've used both unix and mac systems for years. What is the deal with filenames in OSX that have spaces in them. UNIX traditionally doesn't allow/like them. MacOS has. If you try to do many UNIX terminal commands with a filename that has spaces in it, you get "too many arguments" because it starts looking for the next parameter after a filename or other argument. Is there a default character that OSX is using to map to the spaces? I've tried a couple, like "_" but they don't work. Any thoughts?
     
kimball
Guest
Status:
Reply With Quote
Oct 13, 2000, 11:05 PM
 
Use \ to replace spaces:

i.e.

l Desktop\ DB

(edited cuz i read the man page!)

[This message has been edited by kimball (edited 10-14-2000).]
     
Fresh-Faced Recruit
Join Date: Oct 2000
Location: Vail, CO
Status: Offline
Reply With Quote
Oct 13, 2000, 11:33 PM
 
2 ways around:
1) '?' is the wild card for *any* character, and sh and csh will allow it for spaces.
2) Use the 'tcsh' shell and use quotes(ie: more "files with space.txt").
BTW - with tcsh, if you hit tab while typing any command in your path or any file in the current directory, it will finish it for you, including spaces if you started with a quote("). Pretty cool.
     
Professional Poster
Join Date: Jan 2000
Status: Offline
Reply With Quote
Oct 14, 2000, 08:06 PM
 
Kimbal almost got it right. You use the "escape" \ to "escape" charters that the shell interprets for control. So for the space you have \ and for ? you have \? and for * you have \*. No need for two of them.


Read the man page for your shell to get the details.


Did I mention that it's all in the man page for the shell?

>man tcsh
>man csh
>man ksh
>man sh

Read the man page. Read the man page.

[This message has been edited by Scott_H (edited 10-14-2000).]
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Oct 16, 2000, 07:20 AM
 
The other way to do this is to put the filename in quotes, as in "Desktop DB". I don't know how you handle this for a filename that happens to have spaces and quote marks in it already, but I'd also imagine I just haven't run into that yet.

As far as I know, while Unix may not like wierd characters in filenames the only one you're technically forbidden from having in a filename is a foreslash, since that's the one it uses for directories.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:45 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2