# howTo: File naming using ActionScript 3.0

**URL:** https://forum.kirupa.com/t/howto-file-naming-using-actionscript-3-0/300015
**Category:** flash
**Created:** [November 14, 2009, 1:15pm UTC](https://forum.kirupa.com/t/howto-file-naming-using-actionscript-3-0/300015 "2009-11-14T13:15:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)
#### Post date: [November 14, 2009, 1:15pm UTC](https://forum.kirupa.com/t/howto-file-naming-using-actionscript-3-0/300015/1 "2009-11-14T13:15:00Z")

</div>

Hello Friends, I have got a big problem.

**Aim:**  
When a user interacts with my Flash (AIR app, this is a chat bot application) the conversations need to be stored to resemble past memory. So each time the file should be saved with different names. **How to do the naming part**?)

How to create files in a folder(lets name the folder as ‘memory’) inside the application directory **consecutively**.  
=\>How to make files named past **0** , past **1** , past **2** , etc in ‘memory’ folder inside the application directory. If the file in already present, i.e file0 is already present then the name of the current file must be file1.

So I try to do this another way _(But if you have any idea of doing it straight fashion please share the idea)_:  
but my **problem** :  
how to pass a variable name instead of the parameter.  
i.e

```auto

var myFile:File = File.applicationDirectory.resolvePath("app:/memory/past.db");

```

Instead of giving directly the string “app:/memory/past.db” is there any way to give it like  
app:/memory/past **X**.db where **X** = 0, 1, 2…

\*If somehow the above idea could be worked out then, I think that the variable **X** could be stored to another file say index and each time the user opens the app, I can read the \*\*X \*\*value and increment it by one and append it to “past” + \*\*X \*\*+ “.db” and store the modified \*\*X \*_value back to index_.

Please help.  
I’m stuck of days.  
Thank You.
