Characters Forbidden in File Names

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Characters Forbidden in File Names

    For the purpose of enabling a Perl module, currently in development, to
    function properly on the most common operating systems, can anyone provide a
    link to a definitive list of:

    1. Which characters are forbidden in filenames on Windows, *nix and Mac OS?

    2. Which of these operating systems have limitations on the length of
    filenames?

    I ask these questions because my module creates plain-text files named
    according to content extracted from the subject lines of e-mail. Such
    subject lines may contain either too many characters for a particular OS or
    characters forbidden in filenames on that OS.

    Thanks in advance.

    Jim Keenan


    Jim Keenan Guest

  2. Similar Questions and Discussions

    1. #13961 [Ver->Bgs]: some characters in server variable names are silently changed
      ID: 13961 Updated by: iliaa@php.net Reported By: lampa at fee dot vutbr dot cz -Status: Verified +Status: ...
    2. #13961 [NoF->Opn]: some characters in server variable names are silently changed
      ID: 13961 User updated by: lampa at fee dot vutbr dot cz -Summary: some characters in incomonig variable names are...
    3. #19404 [Com]: Post variable names stripped of first 4 characters
      ID: 19404 Comment by: dbradfor at nwlink dot com Reported By: mv02 at gmx dot de Status: Closed Bug Type: ...
    4. #13961 [Com]: some characters in incomonig variable names are silently changed
      ID: 13961 Comment by: daniele at orlandi dot com Reported By: lampa at fee dot vutbr dot cz Status: No Feedback...
    5. #19404 [Csd]: Post variable names stripped of first 4 characters
      ID: 19404 Updated by: helly@php.net Reported By: mv02 at gmx dot de Status: Closed Bug Type: mbstring...
  3. #2

    Default Re: Characters Forbidden in File Names

    In article <N6YTb.13593$KV5.251@nwrdny01.gnilink.net>,
    "Jim Keenan" <no_spam_for_jkeen@verizon.net> wrote:
    > For the purpose of enabling a Perl module, currently in development, to
    > function properly on the most common operating systems, can anyone provide a
    > link to a definitive list of:
    >
    > 1. Which characters are forbidden in filenames on Windows, *nix and Mac OS?
    >
    > 2. Which of these operating systems have limitations on the length of
    > filenames?
    Unix allows filenames to contain any character except /, which is used
    as a directory separator. However, some characters can be problematic
    in different ways. I think filenames are limited to 255 characters.

    I don't remember exactly which characters aren't allowed in Windows
    filenames, but definitely / \ * ? and I think < >. I think the max
    length is 255 there, too.

    Classic MacOS allows filenames to have any character except : (which
    functions roughly as / does in Unix) and limits filenames to 31
    characters.

    Mac OSX supports filenames with up to 255 Unicode characters, but no
    slashes (it's Unix underneath).
    > I ask these questions because my module creates plain-text files named
    > according to content extracted from the subject lines of e-mail. Such
    > subject lines may contain either too many characters for a particular OS or
    > characters forbidden in filenames on that OS.
    You would probably be better off restricting yourself to a "least common
    denominator" of characters known to be valid in all three OSes,
    something like letters, digits, certain punctuation such as periods,
    commas, dashes, etc.
    --
    Found Poetry (_Science News_, 14-Jun-2003): oldest _homo sapiens_ find
    +-----------------------------------------+ ocean eddies' far-flung effects;
    | Kevin Michael Vail <kevin@vaildc.net> | superior threads spun
    +-----------------------------------------+ the pox from prairie dogs.
    Kevin Michael Vail Guest

  4. #3

    Default Re: Characters Forbidden in File Names

    On Tue, 03 Feb 2004 23:27:19 -0500, Kevin Michael Vail
    <kevin@vaildc.net> wrote:
    > Unix allows filenames to contain any character except /, which is
    > used as a directory separator. However, some characters can be
    > problematic in different ways. I think filenames are limited to 255
    > characters.
    Some very old versions have a 14-character limit.
    > You would probably be better off restricting yourself to a "least
    > common denominator" of characters known to be valid in all three
    > OSes,
    Do you also want to include VMS and DOS? What about ISO9660
    > something like letters, digits, certain punctuation such as periods,
    > commas, dashes, etc.
    --
    Philip Newton <nospam.newton@gmx.li>
    That really is my address; no need to remove anything to reply.
    If you're not part of the solution, you're part of the precipitate.
    Philip Newton Guest

  5. #4

    Default Re: Characters Forbidden in File Names

    On Tue, 03 Feb 2004 23:27:19 -0500, Kevin Michael Vail
    <kevin@vaildc.net> wrote:
    > Unix allows filenames to contain any character except /, which is
    > used as a directory separator. However, some characters can be
    > problematic in different ways. I think filenames are limited to 255
    > characters.
    Some very old versions have a 14-character limit.
    > You would probably be better off restricting yourself to a "least
    > common denominator" of characters known to be valid in all three
    > OSes,
    Do you also want to include VMS and DOS? What about ISO9660 CD file
    system?

    I think the latter is the most restrictive; IIRC up to eight uppercase
    letters or digits (maybe underscores), optionally followed by one dot
    and up to three more letters or digits. I believe there are also
    limitations on the depth of nested directories.

    DOS itself is only slightly less restricted - also "8.3" but with more
    allowed characters.
    > something like letters, digits, certain punctuation such as periods,
    > commas, dashes, etc.
    For maximum compatibility, not more than one period.

    Cheers,
    Philip
    --
    Philip Newton <nospam.newton@gmx.li>
    That really is my address; no need to remove anything to reply.
    If you're not part of the solution, you're part of the precipitate.
    Philip Newton Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139