Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Which characters are invalid for an ext3 filename? I imagine that at least / is an invalid character and probably \0. Is there an official list somewhere?

I'm not exactly sure where to look for this information, so please tell me where you found it.

share|improve this question
    
An interesting, albeit lengthy, read: Fixing Unix/Linux/POSIX Filenames. –  Dennis Williamson Dec 1 '10 at 22:41

2 Answers 2

up vote 6 down vote accepted

Just those two.

From the wikipedia page on ext3:

Allowed characters in filenames - All bytes except NULL and '/'

share|improve this answer
    
Ah, I didn't see the stats at the side of the wikipedia page. Thanks! –  User1 Dec 1 '10 at 21:26

/ seems to be allowed, at least on ext3 (supposedly in all, ext, ext2 & ext3 at least, likely also ext4) - just try this:

f='test/file'; echo "Test: '${f}'"
for c in touch ll rm ;do
eval "${c} '${f}'"
done

That will create "test/file", surprised me too... It will create it, show it with ls command and finally remove it with rm

You can type it on one line in bash:

$ f='test/file';for c in touch ll rm ;do eval "${c} '${f}'";done

So / seems to be (bizerrely) allowed in filenames - probably many tools can get confused with such though...

share|improve this answer
    
Cool trick, though probably ill-advised on production systems :-) –  voretaq7 Oct 19 '12 at 18:58
    
Errr… do you have a directory called 'test'? That'll make a difference: touch: cannot touch 'test/file': No such file or directory –  MikeyB Oct 19 '12 at 19:35
    
Though useful as a joke to pull on one's assistants. –  Magellan Oct 19 '12 at 20:05
    
No just managed to create a file named "test/file" - would be interesting to try it with existing directory named test... It might not even give trouble, after all, the / at the end of directory name isn't really part of it's name... So I could imagine them actually working together... It'll look confusing though... Or did you mean you actually tried it? :) –  robsku Jul 22 at 13:10

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.