# Command: RenameFolderAddCount

**URL:** https://resource.dopus.com/t/command-renamefolderaddcount/18781
**Category:** Buttons/Scripts
**Tags:** script, commands, jscript
**Created:** [July 21, 2014, 2:40pm UTC](https://resource.dopus.com/t/command-renamefolderaddcount/18781 "2014-07-21T14:40:31Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![tbone](https://resource.dopus.com/user_avatar/resource.dopus.com/tbone/32/25726_2.png) [@tbone](https://resource.dopus.com/u/tbone)
#### Post date: [July 21, 2014, 2:40pm UTC](https://resource.dopus.com/t/command-renamefolderaddcount/18781/1 "2014-07-21T14:40:31Z")

</div>

RenameFolderAddCount - a script command which is able to add the number of files or subfolders to a folders name.

Short feature summary:

- limit counting of files by specifying a list of file-extensions
- customizable rename pattern (to append/prepend to the foldername e.g.)
- limit counting of files and subfolders to x-number of subfolders deep (or fully recursive by default)

Command Parameters:

Command-line parameters can be used to override script-config defaults:

- `EXTENSIONS`
- `PATTERN`
- `DEEPNESS`

By default it will rename a folder named `My Folder` containing 10 files to `MyFolder (10)`.

By specifying, for example, `pattern="%numfolders% - * - %numfiles%"` the folder `My Folder` will be renamed to `34 - My Folder - 10`, assuming it has a total of 34 subfolders and 10 files (recursive mode).

To prevent counting of files and subfolders which are not directly located below but anywhere deeper, use `deepness=0`.

In case you'd like to limit counting to `*.txt` and `*.doc` files, use `extensions=".txt;.doc"`.

Default Parameters:

Default values can be customized from the script's Config dialog:

![](https://resource.dopus.com/uploads/default/original/2X/2/2c5bbd71069e9f00d3fb38bfdf4bb0ba39f22097.png)

Installation:

To install the command, download the \*.js.txt file below and drag it to Preferences / Toolbars / Scripts.

You can open the script's Config window from the same place, once the script is installed.

Create a button or hotkey with the command `RenameFolderAddCount` and it's ready to go with the defaults.

Download:

- Latest: v0.3.1 - support for updates/scriptwizard:  
[Command.Folder\_RenameFolderAddCount.js.txt](https://resource.dopus.com/uploads/default/original/3X/e/a/ea02ed2da0132e4d8e7d6de64becbabe1ea9f8bf.txt) (5.23 KB)

- v0.3 - fix for deepness limitation not working:  
[Command.Folder\_RenameFolderAddCount.js.txt](https://resource.dopus.com/uploads/default/original/3X/f/b/fb07236d6f263f5ec9126fc2cd749ad899ab4785.txt) (4.27 KB)

- v0.2 - paramter handling cleaned, counting folders added, "native" recurse mode:  
[Command.Folder\_RenameFolderAddCount.js.txt](https://resource.dopus.com/uploads/default/original/3X/d/4/d425bf4f3a4b06f18ecada3468ac1ae91a0148a7.txt) (4.25 KB)

- v0.1 - initial version:  
[Command.Folder\_RenameFolderAddCount.js.txt](https://resource.dopus.com/uploads/default/original/3X/d/1/d15b12460fe68b33ad1d3fc1739f223c769d83d9.txt) (3.94 KB)

---

_[View the full topic](https://resource.dopus.com/t/command-renamefolderaddcount/18781)._
