# Auto create a new folder for each file, then transfer each file into its own folder

**URL:** <https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452>\
**Category:** Help & Support\
**Created:** [June 12, 2022, 3:55am UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452 "2022-06-12T03:55:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![neergttocsdivad](https://resource.dopus.com/letter_avatar_proxy/v4/letter/n/43a26b/32.png) [@neergttocsdivad](https://resource.dopus.com/u/neergttocsdivad)\
**Post date:** [June 12, 2022, 3:55am UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/1 "2022-06-12T03:55:44Z")

</div>

I have say 10 files in a folder/directory.  
The files are named 01, 02 . . . . 10.  
May I create a button that will generate 10 sub-folders (ideally, named 01 to 10)  
then, transfer file 01 to folder 01, file 02 to folder 02 etc

I have tried:

> [@Button to move files in folder named from file](https://resource.dopus.com/t/button-to-move-files-in-folder-named-from-file/8770/2):
>
> just a little change, the button couldn't work in the case folders are broswed automatically after creation. READAUTO=no is added when creating the folder. \<?xml version="1.0"?\> \<button backcol="none" display="both" separate="yes" textcol="none" ty…

> [@Create folder from file name and move file into](https://resource.dopus.com/t/create-folder-from-file-name-and-move-file-into/11533):
>
> is it possible to create a button that creates folder from a file name in the folder its located and then move the file into it? if so how?

but these create only one sub-folder into which all the files are transferred.

Regards  
David

---

<div class="post-metadata">

**Author:** ![lxp](https://resource.dopus.com/user_avatar/resource.dopus.com/lxp/32/33734_2.png) [@lxp](https://resource.dopus.com/u/lxp)\
**Post date:** [June 12, 2022, 8:55am UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/2 "2022-06-12T08:55:49Z")

</div>

```
Rename TO={file}\*
```

---

<div class="post-metadata">

**Author:** ![neergttocsdivad](https://resource.dopus.com/letter_avatar_proxy/v4/letter/n/43a26b/32.png) [@neergttocsdivad](https://resource.dopus.com/u/neergttocsdivad)\
**Post date:** [June 12, 2022, 2:01pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/3 "2022-06-12T14:01:17Z")

</div>

Thank you for your fast response.  
How do I use 'Rename TO={file}\*' ?

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 12, 2022, 2:23pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/4 "2022-06-12T14:23:05Z")

</div>

> [@How to use buttons and scripts from this forum](https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546/1):
>
> This post explains how to add buttons to toolbars and menus, and also applies to raw commands for things like standalone hotkeys. For how to use Script Add-Ins, please scroll down to the post below this one. See Also: The manual has more detail in…

---

<div class="post-metadata">

**Author:** ![neergttocsdivad](https://resource.dopus.com/letter_avatar_proxy/v4/letter/n/43a26b/32.png) [@neergttocsdivad](https://resource.dopus.com/u/neergttocsdivad)\
**Post date:** [June 12, 2022, 9:29pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/5 "2022-06-12T21:29:59Z")

</div>

When I asked "how do I use 'Rename TO={file}\* '", it was because it looked so simple in comparison with the buttons I had already tried.  
Anyway, I pasted it into the Command Editor / Function, but without much hope . . . . . and it worked beautifully.  
Thank you.

---

<div class="post-metadata">

**Author:** ![neergttocsdivad](https://resource.dopus.com/letter_avatar_proxy/v4/letter/n/43a26b/32.png) [@neergttocsdivad](https://resource.dopus.com/u/neergttocsdivad)\
**Post date:** [June 12, 2022, 9:36pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/6 "2022-06-12T21:36:06Z")

</div>

(How) Can I prevent the extension from appearing in the folder names?  
I know how to remove them easily enough, but if its possible not to have them . . .

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 12, 2022, 9:42pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/7 "2022-06-12T21:42:00Z")

</div>

`{file}` gives you the filename.  
`{file|noext}` gives you the name without the extension.

[https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Codes\_for\_passing\_filenames.htm](https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Codes_for_passing_filenames.htm)

---

<div class="post-metadata">

**Author:** ![neergttocsdivad](https://resource.dopus.com/letter_avatar_proxy/v4/letter/n/43a26b/32.png) [@neergttocsdivad](https://resource.dopus.com/u/neergttocsdivad)\
**Post date:** [June 12, 2022, 9:50pm UTC](https://resource.dopus.com/t/auto-create-a-new-folder-for-each-file-then-transfer-each-file-into-its-own-folder/41452/8 "2022-06-12T21:50:10Z")

</div>

Thanks again
