Create new file through script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ryan329

I’m trying to create a new .txt or .csv file (whichever is easier for you to make) and trying to call the file “Movement_(unix time timestamp)”. How would you go about this? I’ve used this to attach the time stamp to a string:

var file = File.new()
var format_string = "Movement_%s"
var actual_string = format_string % OS.get_unix_time()

Also how would I go about adding the file name to the user path?

:bust_in_silhouette: Reply From: Eric Ellingson
var file = File.new()
var actual_string = "user://Movement_%s.csv" % OS.get_unix_time()
file.store_string("1,2,3,4")
file.close()