# Create folder in temporary folder

**URL:** <https://forum.xojo.com/t/create-folder-in-temporary-folder/15076>\
**Category:** Xojo Cloud\
**Created:** [March 19, 2014, 12:38pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076 "2014-03-19T12:38:00Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 19, 2014, 12:38pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/1 "2014-03-19T12:38:00Z")

</div>

Is it possible/permitted to create subfolders in the /tmp folder on Xojo Cloud server?

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 19, 2014, 12:41pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/2 "2014-03-19T12:41:43Z")

</div>

Use SpecialFolder.Temporary.

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 19, 2014, 12:51pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/3 "2014-03-19T12:51:07Z")

</div>

Sorry, I didn’t put enough detail in my message. What I am doing is using the GetTemporaryFolderItem and then parsing out the part of the returned file that looks like rbtA43B to create a folder. I am doing it this way because my app creates a bunch of separate files and at the end I just want to delete them all. It is “easier” to delete a folder than all the separate files.

If I can’t create the folder I will come up with another method. Maybe I will try to save all the information in one tmp file (e.g., everything goes into rbtA43B.tmp) or just reuse the rbtA43B multiple times (e.g., rbtA43B\_file1,tmp, rbtA43B\_file2.tmp, etc).

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 19, 2014, 12:54pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/4 "2014-03-19T12:54:19Z")

</div>

It’s not really easier. You can’t delete the folder without deleting its contents.

Keeping that in mind, SpecialFolder.Temporary is only your temp files, so there will never be conflicts unless you create them.

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 19, 2014, 12:59pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/5 "2014-03-19T12:59:38Z")

</div>

Well, I can delete entire folder with files on PC. I guess Linux is different.

I will just use option 2 (append something to filename provided by GetTemporaryFolderItem).

By the way, what are the temp filenames based on?

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 19, 2014, 1:07pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/6 "2014-03-19T13:07:41Z")

</div>

We get those from the operating system.

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 19, 2014, 1:11pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/7 "2014-03-19T13:11:26Z")

</div>

Thanks for your help Greg.

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 21, 2014, 12:05pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/8 "2014-03-21T12:05:34Z")

</div>

Followup: I want to add something to the filename created by GetTemporaryFolderItem so I don’t have to keep track of all the different temporary filenames. I wanted to do something like this: MyApp\_rbx345\_MyData1.tmp, MyApp\_rbx345\_MyData2.tmp, etc for each file created by the app. I don’t think this is allowed on the Xojo Cloud server (it works fine on the localhost Windows PC). If I just use the filename as is from GetTemporaryFolderItem (in this example, rbx345.tmp which is created in tmp folder) it works.

Is it possible to use custom filenames in the tmp folder on the Xojo Cloud server?

Error I get when using my custom filename is here:

Unhandled IOException  
Message:

Stack:  
TextOutputStream.!Create%o%o  
InstructionPage.InstructionPage.CheckID%%o\<InstructionPage.InstructionPage\>  
InstructionPage.InstructionPage.GoToLogin2\_Action%%o\<InstructionPage.InstructionPage\>o  
Delegate.IM\_Invoke%%o  
AddHandler.Stub.28%%  
WebButton.\_ExecuteEvent%b%osA1v  
WebControl.!\_ExecuteEvent%b%ssA1v  
WebSession.\_HandleEvent%%oso\<HTTPServer.HTTPRequestContext\>  
WebSession.\_HandleRequest%i4%oso\<HTTPServer.HTTPRequestContext\>  
WebApplication.HandleHTTPRequest%%oo\<HTTPServer.HTTPRequestContext\>  
\_CGIGateway.GatewayRequestThread.Event\_Run%%o\<\_CGIGateway.GatewayRequestThread\>

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 21, 2014, 12:31pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/9 "2014-03-21T12:31:53Z")

</div>

There are actually two temporary folders on Xojo cloud. There is the system temp folder (where GetTemporaryFile points) and SpecialFolder.Temporary which is fully readable/writable by your apps. If you use the latter, you can use any name you want. The former is restricted by SELinux rules to only allow the names given to you.

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 21, 2014, 12:52pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/10 "2014-03-21T12:52:01Z")

</div>

Here is the path I am trying to save to which is produced by using SpecialFolder.Temporary:

/home/sites/www.example.com/tmp/

Here is the path produced by GetTemporaryFolderItem:

/tmp/

I don’t know which path to use but I tried the custom filename to /home/sites/www.example.com/tmp/ and got the error so I assume the path produced by GetTemporaryFolderItem is the correct one; unfortunately, I am at a loss as to how to use that path in a way that isn’t OS-specific. Any pointers?

---

<div class="post-metadata">

**Author:** ![Ken\_Gish](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/e495f1/32.png) [@Ken\_Gish](https://forum.xojo.com/u/Ken_Gish)\
**Post date:** [March 21, 2014, 1:44pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/11 "2014-03-21T13:44:29Z")

</div>

Ok. I used GetTemporaryFolderItem.parent (/tmp/ on the server). It seems to have worked (no errors at least)! Thanks for pointing me in the right direction (again).

---

<div class="post-metadata">

**Author:** ![Frederick\_Roller](https://forum.xojo.com/user_avatar/forum.xojo.com/frederick_roller/32/479_2.png) [@Frederick\_Roller](https://forum.xojo.com/u/Frederick_Roller)\
**Post date:** [March 21, 2014, 1:53pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/12 "2014-03-21T13:53:36Z")

</div>

> [@73105:@Greg O'Lone](#):
>
> There are actually two temporary folders on Xojo cloud. There is the system temp folder (where GetTemporaryFile points) and SpecialFolder.Temporary which is fully readable/writable by your apps. If you use the latter, you can use any name you want. The former is restricted by SELinux rules to only allow the names given to you.

This is good to know. Perhaps it should be added to the Xojo documentation.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:07pm UTC](https://forum.xojo.com/t/create-folder-in-temporary-folder/15076/13 "2020-10-29T17:07:48Z")

</div>


