Log In  

Firstly,

PLEASE DO NOT TRY THIS!!!

You may end up with files or folders that you cannot remove.

(I don't wanna be responsible for damages!)
Edit: It turns out there is a way to remove them, see below.

Illegal Names?

Not many people know this, but there are some folder or file names that Windows won't allow you to use. These include 'con', 'aux', 'nul', 'lpt0', and others. Seriously, if you're using Windows right now, make a new folder, and name it "con", it will tell you "The specified device name is invalid". (This is safe to try since the folder never actually gets renamed)

Through curiosity I discovered that PICO-8 completely ignores this rule and allows you to create folders or files with these names using the 'mkdir' and 'save' commands.

What's the problem?

Naming a folder 'con' seemed to have no issues other than refusing to be opened by the 'folder' command, however once I named a folder 'nul', it became impossible to remove. Windows prevents you from renaming or deleting it, so I now have a folder that I can move around, but not remove, rename, or open.

*This is what it shows when trying to rename the 'nul' folder. The folder isn't 'too big', Windows just isn't designed to handle this situation.

EDIT: Thanks to @2bitchuck, you can remove these folders by opening Command Prompt and typing rmdir \\.\C:\path_to_folder /s, replacing "path_to_folder" with the full path of the folder.

The solution?

The only solution I can think of is that PICO-8 checks whether it is running on Windows, and prevents the user from creating illegal folder names.

P#110747 2022-04-23 15:51 ( Edited 2022-04-23 22:04)

1

Wow ! Yeah NUL is completely reserved, @megabyte112. Unbelievable that Pico-8 allows it. Hmm ... Makes me wonder if I can write a tool to remove invalid folder names such as nul.

I'll return.

No ... Blitz is too smart. It refuses to either create or even acknowledge such directories as CON or NUL. This is definitely something for @zep to repair.

Have you tried renaming the CON or NUL folders to something normal like, "aaa" so they can be accessed and/or deleted ? In Windows Explorer, that is the F2 key to rename a file or folder.

P#110754 2022-04-23 17:48 ( Edited 2022-04-23 18:25)
1

Hi @dw817,
Some of the folder names, like 'con' or 'lpt0' are able to be renamed by explorer without issues. The 'nul' folder asks for administrator permissions to rename, then shows an error saying "The file 'nul' is too large for the destination file system". I tried using Windows Powershell, but still no luck. Looks like this folder is stuck now! I can still move it to other places on the same drive, but not to another drive.

I think PICO-8 really needs to prevent users from making folders like these, especially since you can end up with a permanent file or folder that can't be removed!

P#110756 2022-04-23 18:25 ( Edited 2022-04-23 18:27)
1

so I made the same thing AND NOW I CAN'T DELETE 'CON' AND 'NUL' FOLDERS PLSPLSPSL HELPLP

Edit: Deleted, thx for update

P#110757 2022-04-23 19:18 ( Edited 2022-04-25 18:23)

@kreyk29 oops - I probably should put a warning telling people not to do this!

P#110758 2022-04-23 19:19

@megabyte112 Can you delete the NUL folder from Command Prompt using:

rmdir \\.\C:\pico-8\NUL

(modify the path as needed)

P#110759 2022-04-23 20:12
1

@2bitchuck YES! This works after appending '/s' to the end of the command, since the folder did contain files. So it is possible to remove the folders, but still not a good idea to make them.

P#110760 2022-04-23 20:31
3

Thanks @megabyte112 -- fixed for 0.2.4d. Reserved file and directory names are now refused regardless of the host operating system. Interestingly, even reserved names with added .p8 extensions are inadvisable.

From https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

> CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

P#110914 2022-04-27 00:58

@zep

I suspect it's because of possible confusion for people running Windows with hidden file extensions, which is one of my most-hated default settings in Windows.

You don't want novice users doing stuff on their command line that refers to special device pipes like nul by accident, just because they don't see the .txt on nul.txt.

P#110917 2022-04-27 01:13

Hey, @zep!

On Windows 10 and earlier, the names "COM0" and "LPT0" are also forbidden. It also becomes impossible to name files con.jpg or nul.txt for example. All of these are fine on Windows 11, for some reason.

P#110967 2022-04-27 20:18

To be fair, even some Microsoft' Tools can create Files that aren't allowed. For example, "mklink" can create a File named nul, which is impossible to delete with the Windows-Explorer...

P#110968 2022-04-27 20:36 ( Edited 2022-04-27 20:37)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 21:31:32 | 0.052s | Q:31