which characters cannot be used in filenames?

Asked

Viewed 29,915 times

0

We know that it is common to use systems that save files, I would like to know which characters are invalid to be used as filenames? there is a function that removes all characters other than letters ?

  • Related or duplicate to: https://answall.com/q/184020/57801

  • In which operating system?

  • windowns even @Maniero

1 answer

2

When creating a file or folder on your computer, there are some characters that are not allowed to use in their names.

Check out what they are:

\
/
|
?
<
>
*
:
“

Valid characters for naming files or folders include all letters of the alphabet (from A to Z) and numbers (from 0 to 9), in addition to special characters:

^ 
& 
‘ 
@ 
{ 
} 
[ 
] 
, 
$ 
= 
! 
– 
# 
( 
) 
% 
. 
+ 
~ 
_ 

Source: http://www.cursosdeinformaticabasica.com.br/quais-sao-os-caracteres-invalidos-para-a-criacao-de-arquivos-e-pastas/

About the function, see this question of another user.

$callback = function ($value) {
    return preg_replace('/\W+/u', '', $value);
};

array_map($callback, $array);
  • 1

    Missing add question mark "?" .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.