Dashes in filenames - Save As

Hi Everyone,

As I understand it, dashes are allowed in sketch filenames. When I create a new sketch named MySketch_2025-05-04_01.ino and then perform a Save As to make a copy, where I'd like to manually bump the 01 to 02, the Save As form seeds the File name: field with something like MySketch_2025_05_04_01_copy_20250504132031, where the dashes are now underscores. I can change the underscores back to dashes before saving, and the new sketch/folder names honor those edits, but I have to change it every time I "Save As".

Why are the dashes changed to underscores? This is not new behavior for 2.x, but it's getting frustrating.

Also, is there an option to stop the IDE from modifying the name at all (meaning skip the appended "copy" + {time stamp}), as I wipe that out anyway.

Finally, I see the IDE does NOT prompt to avoid an accidental overwrite if I fail to bump the filename during my manual renaming - was this also intentional?

TIA!

I am using IDE 2.3.6. It lets me insert "dashes" as well as open and save with dashes.

filename-test.ino

FILE >> PREFERENCES >> AUTOSAVE (uncheck it)

1 Like

Thanks xfpd - after you have saved the sketch that has dashes (maybe try my exact filename), and you then select File > Save As..., the dashes are still in the filename?

I would have thought this option would enable periodic backups in some recovery folder. Will try...

UPDATE: It is already unchecked.

As far as I know, the Auto Save option controls where or not the IDE saves changes made to the sketch automatically whenever you compile or close the IDE.

I am seeing the same problem with "Save As", with Arduino IDE 2.3.6 running on Ubuntu 24.04, although I get a prompt if the file name already exists.

1 Like

You are right. Changes to underscores when "save as" is used.

You could run a shell script (msdos batch) to start the IDE and rename the files after closing the IDE.

1 Like

Yeah, I must have goofed when I thought I had the same name in this scenario. It does have the ugly Windows behavior of browsing into the folder of that name when the name is unchanged, then expecting you to type in another filename. But if you somehow convince it that you really meant to save over the old file, it will warn you. I would say that when you are asked for a filename, then what you enter (During SAVE AS) should be interpreted as the FILENAME, and thus, it should NOT descend into the existing folder.

Ha - but it adds its own dash in there - well that's a little hypocritical of it!

I added the dash before "copy" as the "save as" filename (and it kept that dash, but changed the other dashes), and the folder was created with the same title. Probably to be cross-platform for Linux, Apple and Windows.

1 Like

Which one doesn't support dashes in file/folder names?

Unix uses the dash for command arguments

ls -l

... in Unix means in Windows...

dir /w
1 Like

Hi @sc01a. The Arduino IDE developers are tracking the bug here:

If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:


:red_exclamation_mark: Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.


1 Like

So that might preclude filenames that begin with a dash for Linux.

I KNEW I was wasting my time! lol

Thanks for the clue-in. Subscribed.

1 Like

If you search "unix filename dash" you will see a lot of "how to delete a file with a dash in the name" and probably no "how to dash your filename"

There are two "dashes" in typography. The "en" dash (short) and the "em" dash (long). I think that might be a reason not to name a file with a dash... as well as the "command argument" mentioned. I am not a computerphile... I am just recalling nightmares from decades past, like a dog and a rolled up newpaper.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.