Forbidden characters in filenames

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
User avatar
geraldholdsworth
Posts: 404
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

Forbidden characters in filenames

Post by geraldholdsworth » Sun Mar 25, 2018 12:03 pm

I cannot, for the life of me, find a list of the characters which are forbidden in DFS and ADFS filenames.
I can take a guess at a few:
DFS ':. *'
ADFS Old/New Directory: ':. *^%'
ADFS Big Directory: ???

Thought it might be in the User Guide (I've only looked at the Acorn Electron, BBC Master and BBC Master Compact user guides - need to dig out the BBC Micro and Acorn Electron Plus 3 ones)

Anyone got any clues?

(by the way, while we at it - I'm also wanting the list of forbidden characters for Commodore 64 disc filenames...if you happen to know them)

Ta muchly,

Gerald.
Gerald Holdsworth
Repton Resource Page
www.reptonresourcepage.co.uk

User avatar
MartinB
Posts: 4979
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity
Contact:

Re: Forbidden characters in filenames

Post by MartinB » Sun Mar 25, 2018 12:12 pm

The Advanced Disc User Guide says....
35108E4E-0601-4C80-B280-2E29543FA7C7.png
That’s DFS but I imagine it didn’t change for ADFS.

RobC
Posts: 2320
Joined: Sat Sep 01, 2007 9:41 pm
Contact:

Re: Forbidden characters in filenames

Post by RobC » Sun Mar 25, 2018 12:22 pm

There's a bit of info in the Acorn ADFS user guide:
A directory name can be up to ten characters long; any characters can be used except # * . : $ & @ or a space
(The above statement is also true of filenames.)
The Disc filing system user guide is not quite as helpful but says:
The file name can be up to seven of most of the characters on the keyboard in any combination, except # * : . as we mentioned earlier.

duikkie
Posts: 2887
Joined: Fri Feb 07, 2014 3:28 pm
Contact:

Re: Forbidden characters in filenames

Post by duikkie » Sun Mar 25, 2018 1:48 pm

don't forget that colour char are not allowed (&80) and char like 0 to &40 ? &7f and so on

you can used them if you load or save a file with a osword call :)

User avatar
jgharston
Posts: 3248
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Forbidden characters in filenames

Post by jgharston » Sun Mar 25, 2018 3:19 pm

geraldholdsworth wrote:I cannot, for the life of me, find a list of the characters which are forbidden in DFS and ADFS filenames.
I can take a guess at a few:
There is no definitive set of forbidden characters, only a definitive set of allowed characters. The only way you can tell if a particular implementation forbids a particular character is to attempt to use it. For instance, the MDFS disallows , [ ] { } quite annoyingly forcing things like "DFS1,20" and "font[80]" to be renamed.

Characters guaranteed to be usable: A-Z, a-z, 0-9, !, _
Characters guaranteed to be forbidden: CHR$13. That's it. That's the *only* character forbidden in a filename as it is the string terminator.

Anything else is dependant on the current implementation you are using. For instance, CFS/RFS will happily use absolutely any character CHR$0-CHR$255 - *SAVE BELL|G|!Z|? 0+1 works.

Characters common sense says should be treated as forbidden: CHR$0-CHR$32, CHR$127-CHR$255

Then, you get to the distinction between leafname characters and filename characters. FRED#1 is a valid filename - it matches one or more objects called FRED+anychar+1, similarly :0.$.HOME.!BOOT is a valid filename.

Characters that most often have a special meaning are:
CHR$32 - space seperator
* - multiple character wildcard
# - single character wildcard
$ - root directory
: - drive specifier
. - directory seperator
^ - parent directory
% - library directory
& - home directory
" - string enclosure
- - as the first character introduces a filing system name
| - character escape character
< - will cause problems on RISC OS
@ - current directory
~ - file server library
\ - previous directory

Sometimes these special characters are only special if used in isolation.
-dfs-file uses - as a special character, but dfs1-20 does not.
% as a single character is the library directory, but %PrintQ is an allowable name.
Mosts DFSs allow you to use . as a leafname character, eg MR.EE.
Many systems allow $ and : interchangeably, allowing :Part1.Dir.file, :Part1.$.Dir.file, $Part1.Dir.file, :.Dir.file, $.Dir.file

The next obvious point is to ask: why do you want to know? What is it you want to do that requires you to second-guess the filing system?

See also the Wiki:
* Filename translation
* Pathname translation

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
geraldholdsworth
Posts: 404
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

Re: Forbidden characters in filenames

Post by geraldholdsworth » Sun Mar 25, 2018 4:04 pm

jgharston wrote:The next obvious point is to ask: why do you want to know? What is it you want to do that requires you to second-guess the filing system?
It's for my Disc Image Reader project - I'm thinking about writing the code to save back to the image. I know that top bit set characters on DFS can be dodgy (as this is where the attributes, and some other information, are stored).

I think I might have enough info to get going here - thank you everyone.
Gerald Holdsworth
Repton Resource Page
www.reptonresourcepage.co.uk

crj
Posts: 834
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Forbidden characters in filenames

Post by crj » Sun Mar 25, 2018 9:20 pm

jgharston wrote:Characters common sense says should be treated as forbidden: CHR$0-CHR$32, CHR$127-CHR$255
FWIW, being able to cajole DFS into accepting filenames with spaces in them is very handy on those rare occasions when you want to read a System disc on a Beeb. While apparently compatible in other ways, they used space instead of $ as the default directory.

I was pleasantly surprised that, apart from needing to enclose things in quotes sometimes, it seemed to work just fine.

Post Reply