Python Forum

Full Version: Windows/DOS python script cannot create a directory name beginning an @ at-sign
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear forum readers,

DOS refuses the creation of a directory which name begins with an "@" (at-sign / at sign).

Unfortunately, I have to create a directory named "@eaDir" (hi, synology photo station users !) within a python script that I want to execute on windows.

The following line raises an error.
os.mkdir("@eaDir")

Does anyone have an idea about how to achieve the creation of directory with an @ at sign at the beginning in a python script executed on windows ?

Thank you !
rewrite windows
@volcano63
trolling windows is always fun !
but trolling...
LucRhan Wrote:The following line raises an error.
What error?
It work for me.
C:\bar
λ ptpython
>>> import os
>>> os.mkdir("@eaDir")
>>> exit()

C:\bar
λ dir
'@eaDir'/  ren.py

C:\bar
λ cd @eaDir
C:\bar\@eaDir
(May-08-2017, 11:55 AM)snippsat Wrote: [ -> ]
LucRhan Wrote:The following line raises an error.
What error?
It work for me.
C:\bar
λ ptpython
>>> import os
>>> os.mkdir("@eaDir")
>>> exit()

C:\bar
λ dir
'@eaDir'/  ren.py

C:\bar
λ cd @eaDir
C:\bar\@eaDir

In fact I am executing a python script from a cmd.exe DOS shell.
I have got the same error when trying to create the directory with a DOS command :
Test> mkdir @eaDir
Le fichier spécifié est introuvable (cannot find specified file)
or with a call to python
[url=http://stackoverflow.com/users/205580/eryksun][/url]Test> python.exe -c "import os; os.mkdir('@eaDir')"
Traceback (most recent call last): File "<string>", line 1, in <module> FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable: '@eaDir'
What version of Windows? I just tried, and it works without issue on Windows 10.
(May-08-2017, 11:38 AM)LucRhan Wrote: [ -> ]@volcano63
trolling windows is always fun !
but trolling...
I did not say anything  Naughty

But while we are at it - probably it was French thing Rolleyes