The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+3 votes

How to create an empty folder in GDScript?

var file ="res://SaveFiles/Save1", File.WRITE)

SaveFiles Folder is not created
i want to create It

but How?

in Engine by (14 points)

Do not write to res://

Write to user:// instead. This is the intended path where user data should go. (naturally, with exceptions always possible)

res:// is not guaranteed to have write rights. This varies on operating system and install method but especially the mobile platforms won't allow writing to res://.

1 Answer

+3 votes

Hello ToufouMaster,

How to create an empty folder in GDScript?

You can create easily an empty folder by passing the path, something like this should create just an empty folder:

func _ready( ):
    # Creates an empty folder.
    var directory = )

    # Then you could create for example a new file like you already do with:
    var file = )
    # Note here the file extension ".txt""res://SaveFiles/save1.txt", File.WRITE)

Note here, that you specify in your path what format your file should have. You missed an extension here! Try to extend your path with ".txt" or another format you want.

see make_dir and the descrpition of File for more information

by (260 points)
edited by

Thank you so much

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.