Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a programming challenge I need a filesystem which supports newline characters in filenames, so a file can be named something like:

A
filename
with
newlines

I can't find any. Can anyone help me?

share|improve this question
2  
I can think of nothing but problems with this. How would you access the file over a CLI? A\nfilename...? Icky! –  Phoshi Apr 10 '10 at 13:56
3  
The only bytes most Unix file systems do NOT allow in file names are slash (/), which separates directory and file names in a path, and NULL (\000), which indicates the end of the name. You can get interesting problems, though, with various programs that are not expecting nonprinting characters like backspace in a file name. –  mpez0 Apr 10 '10 at 15:17
    
Mac OS X does support slashes :) –  rightfold May 5 '10 at 22:13
1  
Mac OS X supports slashes as part of the file name in the GUI, but it does it by translating them into colons when converting from the traditional Mac paths. Colons on the other hand, which Macs traditionally use to separate path components get translated to slashes. A folder called 27/January on a disk called External would appear as External:27/January in the GUI, but that gets converted into the POSIX path /Volumes/External/27:January –  Andrew Turner Dec 25 '11 at 21:01

2 Answers 2

up vote 3 down vote accepted

Most Unix file systems allow for this. But you will often run into trouble with various programs and scripts that won't know how to handle it. If you do

date > 'test-
ing'
ls -lbd test*

Then you will see a \n in the file name which is a newline.

share|improve this answer
2  
When Steve Bourne was testing his shell, he had a directory with 254 single-character file names in it - and it wrought havoc on programs that were not expecting such characters in file names. –  Jonathan Leffler Apr 11 '10 at 4:07

You can find a list of the file naming rules for most operating systems at this link.

Maybe that will help you. I don't see explicitly something about new line characters, though.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.