<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.den4b.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stefan</id>
	<title>den4b Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.den4b.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Stefan"/>
	<link rel="alternate" type="text/html" href="https://www.den4b.com/wiki/Special:Contributions/Stefan"/>
	<updated>2026-05-16T07:15:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Long_paths&amp;diff=3495</id>
		<title>ReNamer:Long paths</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Long_paths&amp;diff=3495"/>
		<updated>2022-08-09T14:06:38Z</updated>

		<summary type="html">&lt;p&gt;Stefan: very &amp;gt; vary&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The maximum length of paths and file/folder names is limited in every mainstream operating system and file system. The exact limits can vary significantly between systems. &lt;br /&gt;
&lt;br /&gt;
For example, in Windows 10 and earlier versions the maximum path length is limited to &#039;&#039;&#039;260 characters&#039;&#039;&#039; (MAX_PATH constant). In contrast, Linux imposes a limit of &#039;&#039;&#039;4096 bytes&#039;&#039;&#039; for full paths and &#039;&#039;&#039;255 bytes&#039;&#039;&#039; for file names. Older systems imposed even stricter limits, like [https://en.wikipedia.org/wiki/DOS DOS] with &#039;&#039;&#039;80 characters&#039;&#039;&#039; limit for full paths and only &#039;&#039;&#039;12 characters&#039;&#039;&#039; (8.3 format) for file names.&lt;br /&gt;
&lt;br /&gt;
Fortunately, this issue is slowly but surely getting addressed, in one way or another. We will also discuss ways of working around some of these limitations.&lt;br /&gt;
&lt;br /&gt;
== Long paths in Windows ==&lt;br /&gt;
&lt;br /&gt;
Modern versions of Windows operating system have an alternative file path specification mechanism which overcomes the &#039;&#039;&#039;260 characters&#039;&#039;&#039; limitation.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s take a conventional file path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;C:\Very\Long\Path&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To convert a path to a &amp;quot;long path&amp;quot; specification, we just need to prepend it with &amp;lt;code&amp;gt;\\?\&amp;lt;/code&amp;gt;, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;\\?\C:\Very\Long\Path&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This effectively raises the maximum length of file paths to &#039;&#039;&#039;32,767 characters&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
However, there are other potential culprits:&lt;br /&gt;
&lt;br /&gt;
* This only raises a limitation imposed by the Windows operating system, while other limitations imposed by file systems may still apply.&lt;br /&gt;
* The support for long paths also depends on capabilities of individual applications.&lt;br /&gt;
&lt;br /&gt;
== Long paths in ReNamer ==&lt;br /&gt;
&lt;br /&gt;
ReNamer normally operates with conventional file paths, but it can also handle the &amp;quot;long path&amp;quot; specification if such was provided.&lt;br /&gt;
&lt;br /&gt;
The standard &#039;&#039;Add Files&#039;&#039; and &#039;&#039;Add Folders&#039;&#039; dialogs cannot handle long paths yet. However, you can use the &#039;&#039;Add Paths&#039;&#039; dialog from the main menu or &#039;&#039;Export/Import&#039;&#039; menu options.&lt;br /&gt;
&lt;br /&gt;
== Truncating long paths ==&lt;br /&gt;
&lt;br /&gt;
The limitation of the maximum file path can make files inaccessible by some applications, including even the &#039;&#039;Windows File Explorer&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A common workaround is to truncate long paths. The truncation can be performed with the help of [[ReNamer:Rules:PascalScript|Pascal Script]] and [[ReNamer:Rules:RegEx|Regular Expressions]] rules.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://docs.microsoft.com/windows/win32/fileio/naming-a-file Windows: Naming Files, Paths, and Namespaces]&lt;br /&gt;
* [https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation Windows: Maximum Path Length Limitation]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits Wikipedia: Comparison of file systems and limits]&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Export_menu&amp;diff=3487</id>
		<title>ReNamer:Export menu</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Export_menu&amp;diff=3487"/>
		<updated>2022-05-05T05:54:42Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
When you click on the [[Image:ExportButton.png]] button, the following menu pops up: &lt;br /&gt;
&lt;br /&gt;
[[Image:ExportMenu.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export file paths and undo paths&lt;br /&gt;
| Exports &#039;&#039;path\current-file-names&#039;&#039; and &#039;&#039;undo paths&#039;&#039; (after renaming) to the .csv (comma separated) or .txt (tab separated) file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export file paths and new names&lt;br /&gt;
| Exports &#039;&#039;path\new-file-names&#039;&#039; to the .csv (comma separated) or .txt (tab separated) file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import file paths and new names&lt;br /&gt;
| Imports &#039;&#039;path\current-file-names&#039;&#039; and &#039;&#039;new names&#039;&#039; from the .csv (comma separated) or .txt (tab separated) file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import files from text-list or play-list&lt;br /&gt;
| Imports &#039;&#039;path\current-file-names&#039;&#039; from the .txt/.log file (one file per line) or .m3u/.pls playlist.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; It will load file paths into &#039;&#039;&#039;Files&#039;&#039;&#039; pane only if the file really exists on your file system.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export as batch renaming file (full paths)&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export as batch renaming file (only names)&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export new names to clipboard&lt;br /&gt;
| Export &#039;&#039;new names&#039;&#039; to clipboard. One name per line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import new names from clipboard&lt;br /&gt;
| Imports &#039;&#039;new names&#039;&#039; from clipboard. Every name should be placed in a new line.&lt;br /&gt;
&lt;br /&gt;
If there is less lines in the clipboard text than files in &#039;&#039;&#039;Files&#039;&#039;&#039; pane last files won&#039;t be renamed.&amp;lt;br&amp;gt;&lt;br /&gt;
If there is more lines in the clipboard text than files in &#039;&#039;&#039;Files&#039;&#039;&#039; pane, then last lines won&#039;t be used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export paths to clipboard&lt;br /&gt;
| Export full original paths of all files to the clipboard.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export all columns to clipboard&lt;br /&gt;
| Exports &#039;&#039;all columns&#039;&#039; to clipboard as a tab separated text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Export_menu&amp;diff=3486</id>
		<title>ReNamer:Export menu</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Export_menu&amp;diff=3486"/>
		<updated>2022-05-04T05:56:44Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
When you click on the [[Image:ExportButton.png]] button, the following menu pops up: &lt;br /&gt;
&lt;br /&gt;
[[Image:ExportMenu.png|frame|none]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export file paths and undo paths&lt;br /&gt;
| Exports &#039;&#039;path\current-file-names&#039;&#039; and &#039;&#039;undo paths&#039;&#039; (after renaming) to the .csv (comma separated) or .txt (tab separated) file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export file paths and new names&lt;br /&gt;
| Exports &#039;&#039;path\new-file-names&#039;&#039; to the .csv (comma separated) or .txt (tab separated) file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import file paths and new names&lt;br /&gt;
| Imports &#039;&#039;path\current-file-names&#039;&#039; and &#039;&#039;new names&#039;&#039; from the .csv (comma separated) or .txt (tab separated) file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import files from text-list or play-list&lt;br /&gt;
| Imports &#039;&#039;path\current-file-names&#039;&#039; from the .txt/.log file (one file per line) or .m3u/.pls playlist.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; It will load file paths into &#039;&#039;&#039;Files&#039;&#039;&#039; pane only if the file really exists on your file system.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export as batch renaming file (full paths)&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export as batch renaming file (only names)&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export new names to clipboard&lt;br /&gt;
| Export &#039;&#039;new names&#039;&#039; to clipboard. One name per line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Import new names from clipboard&lt;br /&gt;
| Imports &#039;&#039;new names&#039;&#039; from clipboard. Every name should be placed in a new line.&lt;br /&gt;
&lt;br /&gt;
If there is less lines in the clipboard text than files in &#039;&#039;&#039;Files&#039;&#039;&#039; pane last files won&#039;t be renamed.&amp;lt;br&amp;gt;&lt;br /&gt;
If there is more lines in the clipboard text than files in &#039;&#039;&#039;Files&#039;&#039;&#039; pane, then last lines won&#039;t be used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export file paths to clipboard&lt;br /&gt;
| Export full original paths of all files to the clipboard.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Export all columns to clipboard&lt;br /&gt;
| Exports &#039;&#039;all columns&#039;&#039; to clipboard as a tab separated text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:TOC&amp;diff=3400</id>
		<title>ReNamer:TOC</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:TOC&amp;diff=3400"/>
		<updated>2020-07-27T05:19:44Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added &amp;quot;Padding&amp;quot;-rule&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Beta}}&lt;br /&gt;
&lt;br /&gt;
{{Open book|Book:ReNamer_User_Manual|Open the book and download the manual as a PDF}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot;| Table of Contents&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Introduction|Introduction]] &lt;br /&gt;
*[[ReNamer:Quick Guide|Quick Guide]] &lt;br /&gt;
*[[ReNamer:Step-by-step|Step-by-step]] &lt;br /&gt;
**[[ReNamer:Adding files and folders|Adding files and folders]] &lt;br /&gt;
**[[ReNamer:Managing rules|Managing rules]] &lt;br /&gt;
**[[ReNamer:Previewing files|Previewing files]] &lt;br /&gt;
**[[ReNamer:Renaming files|Renaming files]]&lt;br /&gt;
*[[ReNamer:Using presets|Using presets]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze window]] &lt;br /&gt;
*[[ReNamer:Manual editing|Manual editing]]&lt;br /&gt;
* Menus and settings&lt;br /&gt;
**[[ReNamer:Program settings|Program settings]] &lt;br /&gt;
**[[ReNamer:Main menu|Main menu]] &lt;br /&gt;
**[[ReNamer:Rules menu|Rules menu]]&lt;br /&gt;
**[[ReNamer:Files menu|Files menu]]&lt;br /&gt;
**[[ReNamer:Files header menu|Files header menu]]&lt;br /&gt;
**[[ReNamer:Filter settings|Filter settings]]&lt;br /&gt;
**[[ReNamer:Export menu|Export menu]]&lt;br /&gt;
**[[ReNamer:Options menu|Options menu]]&lt;br /&gt;
**[[ReNamer:Menus for the Files pane|Menus for the Files pane]]&lt;br /&gt;
&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Using the Rules|Using the Rules]] &lt;br /&gt;
**[[ReNamer:Rules|Overview]] &lt;br /&gt;
**[[ReNamer:Rules:Insert|Insert]] &lt;br /&gt;
**[[ReNamer:Rules:Delete|Delete]] &lt;br /&gt;
**[[ReNamer:Rules:Remove|Remove]] &lt;br /&gt;
**[[ReNamer:Rules:Replace|Replace]]&lt;br /&gt;
**[[ReNamer:Rules:Rearrange|Rearrange]]&lt;br /&gt;
**[[ReNamer:Rules:Extension|Extension]] &lt;br /&gt;
**[[ReNamer:Rules:Strip|Strip]] &lt;br /&gt;
**[[ReNamer:Rules:Case|Case]] &lt;br /&gt;
**[[ReNamer:Rules:Serialize|Serialize]] &lt;br /&gt;
**[[ReNamer:Rules:Randomize|Randomize]]&lt;br /&gt;
**[[ReNamer:Rules:Padding|Padding]]&lt;br /&gt;
**[[ReNamer:Rules:CleanUp|CleanUp]] &lt;br /&gt;
**[[ReNamer:Rules:Translit|Translit]] &lt;br /&gt;
**[[ReNamer:Rules:RegEx|RegEx]]&lt;br /&gt;
**[[ReNamer:Rules:PascalScript|PascalScript]]&lt;br /&gt;
**[[ReNamer:Rules:UserInput|UserInput]]&lt;br /&gt;
**[[ReNamer:Rules:ReformatDate|ReformatDate]]&lt;br /&gt;
&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Date and Time format|Date and Time format]]&lt;br /&gt;
*[[ReNamer:Binary Signatures|Binary Signatures]] &lt;br /&gt;
*[[ReNamer:Meta Tags|Meta Tags]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze dialog]]&lt;br /&gt;
*[[ReNamer:Regular Expressions|Regular Expressions]] &lt;br /&gt;
*[[ReNamer:Pascal Script|Pascal Script]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Quick guide|Quick guide]]&lt;br /&gt;
**[[ReNamer:Pascal Script:Types|Types]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Functions|Functions]]&lt;br /&gt;
**[[ReNamer:Pascal_Script#Script cookbook|Script cookbook]]  &lt;br /&gt;
**[[ReNamer:Scripts|Scripts]] &lt;br /&gt;
*[[ReNamer:Command Line|Command line mode]] &lt;br /&gt;
*[[ReNamer:Sorting files|Sorting files]]&lt;br /&gt;
*[[ReNamer:Masks|Using masks]]&lt;br /&gt;
*[[ReNamer:Renaming folders|Renaming folders]]&lt;br /&gt;
*[[ReNamer:Renaming to another folder|Renaming to another folder]]&lt;br /&gt;
*[[ReNamer:Failed renaming|Failed renaming]]&lt;br /&gt;
*[[ReNamer:Validation|Validation]]&lt;br /&gt;
*[[ReNamer:Skip extension|Skip extension]]&lt;br /&gt;
*[[ReNamer:Examples of Rules|Examples of rules]]&lt;br /&gt;
*[[ReNamer:Rules:Rearrange Examples|Examples of Rearrange rule]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;br /&gt;
[[Category:TOC]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange&amp;diff=3380</id>
		<title>ReNamer:Rules:Rearrange</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange&amp;diff=3380"/>
		<updated>2020-05-22T05:42:59Z</updated>

		<summary type="html">&lt;p&gt;Stefan: ...if an delimiter match at the very end ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:Replace|next=ReNamer:Rules:Extension}}&lt;br /&gt;
&lt;br /&gt;
== Rearrange rule  ==&lt;br /&gt;
&lt;br /&gt;
[[Image:RearrangeRule.png|center]] &lt;br /&gt;
&lt;br /&gt;
This rule allows you to chop up the existing file name and reuse any/all of the parts in any order to compose a new name. &lt;br /&gt;
&lt;br /&gt;
*You can also add your own text, or use meta tags while composing the new name. &lt;br /&gt;
*You can also use the whole original name, and insert literal text (or meta tags) around it.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Split using &lt;br /&gt;
| &lt;br /&gt;
Specifies how to split the existing name into parts. &lt;br /&gt;
&lt;br /&gt;
*You can use only one of the three options at a time (you cannot combine the chopping methods)&lt;br /&gt;
&lt;br /&gt;
For detailed explanation of split methods please look below at the [[#Split options explained|split options explained]] section.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Right-to-left &lt;br /&gt;
| &lt;br /&gt;
If selected, the numbering starts from right. &lt;br /&gt;
&lt;br /&gt;
*The characters of the original names are counted from right (the count begins with 1) &lt;br /&gt;
*The chopped parts will also be numbered from right ($1, $2, etc.)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:PlusButton.png]] &lt;br /&gt;
| Add a separator for additional delimiters. The separator is a &amp;quot;{{Pipe}}&amp;quot; (vertical pipe) character, which can also be entered manually.&lt;br /&gt;
|-&lt;br /&gt;
| New pattern &lt;br /&gt;
| &lt;br /&gt;
How to compose the new name from the parts created from the original name (see above). &lt;br /&gt;
&lt;br /&gt;
*You can add meta tags and literal text wherever you want. &lt;br /&gt;
*$0 refers to the whole original name. This allows you to quickly compose a new name by inserting a string at the beginning and/or end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:ReNamer Insert Meta Tag Button.png]] &lt;br /&gt;
| Click the button to see a list of [[ReNamer:Meta Tags|meta-tags]]. Select any meta tag to insert it in the new name template.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Split options explained ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Option&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Delimiters &lt;br /&gt;
| &lt;br /&gt;
Chop the name where the delimiter occurs. &lt;br /&gt;
&lt;br /&gt;
*The delimiter can be a single character or a string. &lt;br /&gt;
*The chopped parts do &amp;lt;u&amp;gt;&#039;&#039;not&#039;&#039;&amp;lt;/u&amp;gt; contain the delimiters (they are omitted totally) &lt;br /&gt;
*Spaces, numbers and symbols are treated like normal characters. &lt;br /&gt;
*Several delimiters can be used at a time. Use the {{pipe}} character to separate them. &lt;br /&gt;
*The chopped parts are numbered from left, as $1, $2, $3, etc.&lt;br /&gt;
&lt;br /&gt;
:The same parts can be referred from the end as $-1, $-2, $-3, etc.&lt;br /&gt;
&lt;br /&gt;
*If the delimiter occurs at the very beginning of the name, the resultant $1 contains nothing (because there is nothing on the left side of the delimiter).&lt;br /&gt;
*The same is true if an delimiter match at the very end of the name, the resultant $n contains nothing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039;&amp;lt;/span&amp;gt; The number of parts into which the filename is broken down depends solely on the number of delimiters in the filename. If you reference fewer parts in the output pattern that the number of available parts - not referenced parts will be lost! For example, take filename &amp;quot;Artist - Title&amp;quot; and to swap them around one would use &amp;quot; - &amp;quot; as a delimiter and &amp;quot;$2 - $1&amp;quot; as a new pattern which will result in &amp;quot;Title - Artist&amp;quot;, but if some filename appears with more dashes like &amp;quot;Artist - Title - Album&amp;quot; the result will also be &amp;quot;Title - Artist&amp;quot; and last part will be lost. To make sure that no parts are lost use &#039;&#039;&#039;Exact pattern of delimiters&#039;&#039;&#039; option instead. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Positions &lt;br /&gt;
| &lt;br /&gt;
Chop the name at the indicated position (the position count begins with 1). &lt;br /&gt;
&lt;br /&gt;
*If you enter position &#039;&#039;&#039;n&#039;&#039;&#039;, ReNamer will chop the &#039;&#039;&#039;n&#039;&#039;&#039;-th character and all characters beyond that in a separate piece. &lt;br /&gt;
*Spaces, numbers and symbols are treated like normal characters. &lt;br /&gt;
*No part of the original name is omitted during chopping. &lt;br /&gt;
*You can enter multiple positions. Separate them with the &#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039; sequence. &lt;br /&gt;
*The chopped parts are numbered from left, as $1, $2, $3, etc.&lt;br /&gt;
&lt;br /&gt;
:The same parts can be referred from the end as $-1, $-2, $-3, etc.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Exact pattern of delimiters &lt;br /&gt;
| &lt;br /&gt;
Chop the name using the exact pattern (sequence) of the delimiters. &lt;br /&gt;
&lt;br /&gt;
With this option you basically define how many parts you want the filename to be split into and the order in which the delimiters must occur. If you specify 1 delimiter then you end up with exactly 2 parts, if you specify 2 delimiters you&#039;ll get 3 parts, and so on. &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
This rule is so versatile that it can be used in a huge number of ways.&lt;br /&gt;
Therefore its examples have been moved to a separate article [[ReNamer:Rules:Rearrange Examples|Rearrange Examples]].&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Replace&amp;diff=3379</id>
		<title>ReNamer:Rules:Replace</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Replace&amp;diff=3379"/>
		<updated>2020-05-11T12:09:41Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Adjusted the separator ( | &amp;gt; *|* ) in the example at the bottom&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:Remove|next=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
== Replace Rule ==&lt;br /&gt;
&lt;br /&gt;
[[Image:ReplaceRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule removes the specified string from the name and replaces it with another string. It has options to replace the first occurrence, the last occurrence, or all the occurrences. You can replace multiple strings at a time. You can create a pattern with wildcards, so that any string that matches the pattern will be removed. &lt;br /&gt;
&lt;br /&gt;
The parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter &lt;br /&gt;
! Details&lt;br /&gt;
|-&lt;br /&gt;
| Find &lt;br /&gt;
| Enter the string to be replaced. &lt;br /&gt;
*You can enter multiple strings at a time. They will be searched &amp;amp;amp; replaced in the order as they appear. Press the + button to insert a separator between two strings. Instead of pressing this button, you can also enter &#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039; from the keyboard. &lt;br /&gt;
*If the name does not contain the specified string, the rule will not act on it. &lt;br /&gt;
*If the name contains more than one of these strings, it will replace them according to the Occurrences parameter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:PlusButton.png]] button &lt;br /&gt;
| Inserts a separator (&#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039;) sequence between two delimiter entries. (You can directly type&#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039; &lt;br /&gt;
You can use this button in the &#039;&#039;&#039;Replace&#039;&#039;&#039; box also. In that case, the nthe entry in the &#039;&#039;&#039;Find&#039;&#039;&#039; box is replaced by the nths entry in the &#039;&#039;&#039;Replace&#039;&#039;&#039; box. (e.g. A --&amp;amp;gt;A&#039;, B --&amp;amp;gt;B&#039; etc.) } &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Replace &lt;br /&gt;
| Enter strings that will replace the &amp;quot;Find&amp;quot; strings. &lt;br /&gt;
*Note that the number of strings (separated with &#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039;) in &amp;quot;Find&amp;quot; and &amp;quot;Replace&amp;quot; boxes should be the same. If there is more strings in the &amp;quot;Find&amp;quot; box than in the &amp;quot;Replace&amp;quot; box the spare strings will be removed (replaced with an empty string). If there is more strings in the &amp;quot;Replace&amp;quot; box, the spare strings will be ignored.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Insert meta tag &lt;br /&gt;
[[Image:ReNamer Insert Meta Tag Button.png]] &lt;br /&gt;
&lt;br /&gt;
| Click the button to see a list of [[ReNamer:Meta Tags|meta-tags]].&lt;br /&gt;
|-&lt;br /&gt;
| Occurrences &lt;br /&gt;
| In case that strings occur more than once in the filename, specify which occurrences should be replaced. (Options are: &#039;&#039;first only&#039;&#039;, &#039;&#039;last only&#039;&#039;, or &#039;&#039;all&#039;&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
| If this check box is selected, the extension will be ignored by the rule.&lt;br /&gt;
|-&lt;br /&gt;
| Case sensitive &lt;br /&gt;
| Will only remove a specified string from the name if the case matches exactly.&lt;br /&gt;
|-&lt;br /&gt;
| Interpret symbols as wild cards &lt;br /&gt;
| Treat certain symbols as [[#Wildcards|Wildcards]] for matching simple patterns (similar to [[ReNamer:Regular Expressions|Regular Expressions]]). &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Wildcards ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Wildcard&lt;br /&gt;
! Represents&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;*&amp;lt;/center&amp;gt; &lt;br /&gt;
| any number of characters (including numbers, space, underscores, etc.). &lt;br /&gt;
| &#039;&#039;&#039;abc*&#039;&#039;&#039; equals &#039;&#039;&#039;abc&#039;&#039;&#039; followed by 0 or more characters.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;?&amp;lt;/center&amp;gt; &lt;br /&gt;
| Any single character (including numbers, space, underscores, etc.) &lt;br /&gt;
| &#039;&#039;&#039;ab?d&#039;&#039;&#039; equals &#039;&#039;&#039;abcd&#039;&#039;&#039;, &#039;&#039;&#039;ab1d&#039;&#039;&#039;, &#039;&#039;&#039;ab d&#039;&#039;&#039;, &#039;&#039;&#039;ab_d&#039;&#039;&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;[]&amp;lt;/center&amp;gt; &lt;br /&gt;
| Brackets enclose a set of characters, any one of which may match a single character at that position. &lt;br /&gt;
| &#039;&#039;&#039;foo[ab]ar &#039;&#039;&#039;equals &#039;&#039;&#039;fooaar&#039;&#039;&#039; and &#039;&#039;&#039;foobar&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;-&amp;lt;/center&amp;gt; &lt;br /&gt;
| (only within a pair of brackets) denotes a range of characters. &lt;br /&gt;
| &#039;&#039;&#039;foo[a-z]ar &#039;&#039;&#039;equals &#039;&#039;&#039;fooaar&#039;&#039;&#039;, &#039;&#039;&#039;foobar,&#039;&#039;&#039; &#039;&#039;&#039;foocar,&#039;&#039;&#039; &#039;&#039;&#039;foodar,&#039;&#039;&#039; etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Beware of conflicting replacements == &lt;br /&gt;
&lt;br /&gt;
If you enter multiple find and replace strings they will be executed as multiple Replace rules, so first string will go first and only after replacing all (or first, or last) occurrences of that string the second string in the Find box will be searched &amp;amp; replaced.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Find&lt;br /&gt;
! Replace&lt;br /&gt;
|-&lt;br /&gt;
| A*{{Pipe}}*B&lt;br /&gt;
| B*{{Pipe}}*A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name&lt;br /&gt;
! New Name&lt;br /&gt;
|-&lt;br /&gt;
| ABBA.mp3&lt;br /&gt;
| AAAA.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may expect the new name to be &amp;lt;tt&amp;gt;BAAB.mp3&amp;lt;/tt&amp;gt;, but it&#039;s not. This happens because first all &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;&#039;s are replaced with &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;&#039;s (we get &amp;lt;tt&amp;gt;BBBB.mp3&amp;lt;/tt&amp;gt;) and only then all &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;&#039;s are replaced with &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;&#039;s (and the final result is &amp;lt;tt&amp;gt;AAAA.mp3&amp;lt;/tt&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
If you need to apply character-to-character mappings you should use [[ReNamer:Rules:Translit|Translit rule]].&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3378</id>
		<title>ReNamer:Rules:CSV-Import</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3378"/>
		<updated>2020-04-25T14:07:47Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See Export menu&amp;lt;BR&amp;gt;&lt;br /&gt;
There is an &amp;quot;Import file names from text-list (CSV or TXT)&amp;quot; option:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;gt; Imports file paths and new names from the .csv (comma separated) or .txt (tab separated) file.&amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.den4b.com/wiki/ReNamer:Export_menu&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
From http://www.den4b.com/forum/viewtopic.php?pid=10917#p10917&lt;br /&gt;
&lt;br /&gt;
You can save your excel file in CSV format (comma delimited), and then use ReNamer&#039;s import/export options, such as &amp;quot;Import file paths and new names&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you will need to have a full file path in the first column, otherwise ReNamer won&#039;t know where to find the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
If the cell contains spaces, commas or quotation marks, then the cell value must be en-quoted and inner quotation marks escaped properly.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For example:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File.txt&amp;quot;,&amp;quot;My New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File 2.txt&amp;quot;,&amp;quot;My second New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File 3.txt&amp;quot;,&amp;quot;My Another New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
See this article for more examples:&amp;lt;BR&amp;gt;&lt;br /&gt;
https://en.wikipedia.org/wiki/Comma-separated_values#Basic_rules&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You may need to select a different variation of the CSV format when saving from Excel, to get properly en-quoted and escaped cell values.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
ReNamer since v7.1.0.2 Beta handles unquoted values appropriately, so you don&#039;t need to manually enquote all values any more.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3377</id>
		<title>ReNamer:Rules:CSV-Import</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3377"/>
		<updated>2020-04-25T09:59:13Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See Export menu&amp;lt;BR&amp;gt;&lt;br /&gt;
There is an &amp;quot;Import file names from text-list (CSV or TXT)&amp;quot; option:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;gt; Imports file paths and new names from the .csv (comma separated) or .txt (tab separated) file.&amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.den4b.com/wiki/ReNamer:Export_menu&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can save your excel file in CSV format (comma delimited), and then use ReNamer&#039;s import/export options, such as &amp;quot;Import file paths and new names&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you will need to have a full file path in the first column, otherwise ReNamer won&#039;t know where to find the file.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
If the cell contains spaces, commas or quotation marks, then the cell value must be en-quoted and inner quotation marks escaped properly.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For example:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File.txt&amp;quot;,&amp;quot;My New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File 2.txt&amp;quot;,&amp;quot;My second New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\My Folder\My Old File 3.txt&amp;quot;,&amp;quot;My Another New File.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
See this article for more examples:&amp;lt;BR&amp;gt;&lt;br /&gt;
https://en.wikipedia.org/wiki/Comma-separated_values#Basic_rules&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You may need to select a different variation of the CSV format when saving from Excel, to get properly en-quoted and escaped cell values.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
ReNamer v7.1.0.2 Beta handles unquoted values appropriately, so you don&#039;t need to manually enquote all values any more.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:TOC&amp;diff=3376</id>
		<title>ReNamer:TOC</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:TOC&amp;diff=3376"/>
		<updated>2020-04-25T09:28:33Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added hint to CSV-Import&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Beta}}&lt;br /&gt;
&lt;br /&gt;
{{Open book|Book:ReNamer_User_Manual|Open the book and download the manual as a PDF}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot;| Table of Contents&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Introduction|Introduction]] &lt;br /&gt;
*[[ReNamer:Quick Guide|Quick Guide]] &lt;br /&gt;
*[[ReNamer:Step-by-step|Step-by-step]] &lt;br /&gt;
**[[ReNamer:Adding files and folders|Adding files and folders]] &lt;br /&gt;
**[[ReNamer:Managing rules|Managing rules]] &lt;br /&gt;
**[[ReNamer:Previewing files|Previewing files]] &lt;br /&gt;
**[[ReNamer:Renaming files|Renaming files]]&lt;br /&gt;
*[[ReNamer:Using presets|Using presets]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze window]] &lt;br /&gt;
*[[ReNamer:Manual editing|Manual editing]]&lt;br /&gt;
* Menus and settings&lt;br /&gt;
**[[ReNamer:Program settings|Program settings]] &lt;br /&gt;
**[[ReNamer:Main menu|Main menu]] &lt;br /&gt;
**[[ReNamer:Rules menu|Rules menu]]&lt;br /&gt;
**[[ReNamer:Files menu|Files menu]]&lt;br /&gt;
**[[ReNamer:Files header menu|Files header menu]]&lt;br /&gt;
**[[ReNamer:Filter settings|Filter settings]]&lt;br /&gt;
**[[ReNamer:Export menu|Export menu]]&lt;br /&gt;
**[[ReNamer:Options menu|Options menu]]&lt;br /&gt;
**[[ReNamer:Menus for the Files pane|Menus for the Files pane]]&lt;br /&gt;
&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Using the Rules|Using the Rules]] &lt;br /&gt;
**[[ReNamer:Rules|Overview]] &lt;br /&gt;
**[[ReNamer:Rules:Insert|Insert]] &lt;br /&gt;
**[[ReNamer:Rules:Delete|Delete]] &lt;br /&gt;
**[[ReNamer:Rules:Remove|Remove]] &lt;br /&gt;
**[[ReNamer:Rules:Replace|Replace]]&lt;br /&gt;
**[[ReNamer:Rules:Rearrange|Rearrange]]&lt;br /&gt;
**[[ReNamer:Rules:Extension|Extension]] &lt;br /&gt;
**[[ReNamer:Rules:Strip|Strip]] &lt;br /&gt;
**[[ReNamer:Rules:Case|Case]] &lt;br /&gt;
**[[ReNamer:Rules:Serialize|Serialize]] &lt;br /&gt;
**[[ReNamer:Rules:Randomize|Randomize]]&lt;br /&gt;
**[[ReNamer:Rules:CleanUp|CleanUp]] &lt;br /&gt;
**[[ReNamer:Rules:Translit|Translit]] &lt;br /&gt;
**[[ReNamer:Rules:RegEx|RegEx]]&lt;br /&gt;
**[[ReNamer:Rules:PascalScript|PascalScript]]&lt;br /&gt;
**[[ReNamer:Rules:UserInput|UserInput]]&lt;br /&gt;
**[[ReNamer:Rules:ReformatDate|ReformatDate]]&lt;br /&gt;
**[[ReNamer:Rules:CSV-Import|CSV-Import]]&lt;br /&gt;
&lt;br /&gt;
|valign=&amp;quot;top&amp;quot;|&lt;br /&gt;
*[[ReNamer:Date and Time format|Date and Time format]]&lt;br /&gt;
*[[ReNamer:Binary Signatures|Binary Signatures]] &lt;br /&gt;
*[[ReNamer:Meta Tags|Meta Tags]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze dialog]]&lt;br /&gt;
*[[ReNamer:Regular Expressions|Regular Expressions]] &lt;br /&gt;
*[[ReNamer:Pascal Script|Pascal Script]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Quick guide|Quick guide]]&lt;br /&gt;
**[[ReNamer:Pascal Script:Types|Types]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Functions|Functions]]&lt;br /&gt;
**[[ReNamer:Pascal_Script#Script cookbook|Script cookbook]]  &lt;br /&gt;
**[[ReNamer:Scripts|Scripts]] &lt;br /&gt;
*[[ReNamer:Command Line|Command line mode]] &lt;br /&gt;
*[[ReNamer:Sorting files|Sorting files]]&lt;br /&gt;
*[[ReNamer:Masks|Using masks]]&lt;br /&gt;
*[[ReNamer:Renaming folders|Renaming folders]]&lt;br /&gt;
*[[ReNamer:Renaming to another folder|Renaming to another folder]]&lt;br /&gt;
*[[ReNamer:Failed renaming|Failed renaming]]&lt;br /&gt;
*[[ReNamer:Validation|Validation]]&lt;br /&gt;
*[[ReNamer:Skip extension|Skip extension]]&lt;br /&gt;
*[[ReNamer:Examples of Rules|Examples of rules]]&lt;br /&gt;
*[[ReNamer:Rules:Rearrange Examples|Examples of Rearrange rule]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;br /&gt;
[[Category:TOC]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3375</id>
		<title>ReNamer:Rules:CSV-Import</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:CSV-Import&amp;diff=3375"/>
		<updated>2020-04-25T09:24:54Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;See Export menu&amp;lt;BR&amp;gt; There is an &amp;quot;Import file names from text-list (CSV or TXT)&amp;quot; option:&amp;lt;BR&amp;gt; &amp;gt; Imports file paths and new names from the .csv (comma separated) or .txt (tab sep...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See Export menu&amp;lt;BR&amp;gt;&lt;br /&gt;
There is an &amp;quot;Import file names from text-list (CSV or TXT)&amp;quot; option:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;gt; Imports file paths and new names from the .csv (comma separated) or .txt (tab separated) file.&amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.den4b.com/wiki/ReNamer:Export_menu&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=3374</id>
		<title>ReNamer:Rules:UserInput</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=3374"/>
		<updated>2020-04-25T09:18:19Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:PascalScript|next=ReNamer:Rules:ReformatDate}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Image:UserInputRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule replaces the original filenames with the names taken from the list. (The &#039;&#039;n&#039;&#039;th line in the list serves as the new name for the &#039;&#039;n&#039;&#039;th file in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane.) &lt;br /&gt;
&lt;br /&gt;
Naturally, the list should contain names for all the files loaded in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane. &lt;br /&gt;
&lt;br /&gt;
*If the list is shorter, then some of the files will not be renamed. &lt;br /&gt;
*If the list is longer, some of the names will remain unused (but all files in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane will be renamed).&lt;br /&gt;
&lt;br /&gt;
There are three ways to create the list: &lt;br /&gt;
&lt;br /&gt;
#Click in the pane, and manually type the list (one name per line). &lt;br /&gt;
#Copy the list from any application to your clipboard. Switch to ReNamer. Click in the &#039;&#039;&#039;UserInput&#039;&#039;&#039; pane and press &#039;&#039;&#039;CTRL+V&#039;&#039;&#039;, right-click and select &#039;&#039;&#039;Paste&#039;&#039;&#039; or choose the &#039;&#039;&#039;Load from clipboard&#039;&#039;&#039; from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
#Load a list from the text file (available from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
&lt;br /&gt;
The optional parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Insert in front of the current name &lt;br /&gt;
| Inserts the name before the file name.&lt;br /&gt;
|-&lt;br /&gt;
| Insert after the current name &lt;br /&gt;
| Inserts the name &#039;&#039;after&#039;&#039; the current name. The actual position depends on the &#039;&#039;&#039;Skip extension&#039;&#039;&#039; option.&lt;br /&gt;
|-&lt;br /&gt;
| Replace the current name &lt;br /&gt;
| Replaces the existing filename with the new name. &lt;br /&gt;
The effect on extension depends on the &#039;&#039;&#039;&#039;&#039;Skip extension&#039;&#039;&#039;&#039;&#039; option: &lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
|&lt;br /&gt;
*If the option is selected, the extension is ignored and user input strings will affect only the base name of files.&lt;br /&gt;
*If the option is deselected, user input strings will replace entire filename, &#039;&#039;including&#039;&#039; the extension, or will be added &#039;&#039;after&#039;&#039; the old extension (if the &#039;&#039;&#039;Insert after the current name&#039;&#039;&#039; option is selected).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Alternatives ==&lt;br /&gt;
See Export menu  &amp;lt;BR&amp;gt;&lt;br /&gt;
There is an &amp;quot;Import file names from text-list (CSV or TXT)&amp;quot; option&amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.den4b.com/wiki/ReNamer:Export_menu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
For example, if you have this three files:&lt;br /&gt;
* Old name 1&lt;br /&gt;
* Old name 2&lt;br /&gt;
* Old name 3&lt;br /&gt;
&lt;br /&gt;
Then your list of new names should contain exactly three lines like:&lt;br /&gt;
* New name for old name 1&lt;br /&gt;
* new name for old name 2&lt;br /&gt;
* New name for old name 3&lt;br /&gt;
&lt;br /&gt;
==== Example 1 ====&lt;br /&gt;
&lt;br /&gt;
File list is longer then the list of new names:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| &#039;&#039;(will not be renamed)&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example 2 ====&lt;br /&gt;
&lt;br /&gt;
List of new names is longer then the file list:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;(not used)&#039;&#039;&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example 3 ==== &lt;br /&gt;
&lt;br /&gt;
Missed item in the list of new names can cause incorrect ordering:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| Fifth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules&amp;diff=3373</id>
		<title>ReNamer:Rules</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules&amp;diff=3373"/>
		<updated>2020-04-25T09:16:31Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added hint for CSV-Import&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer}}&lt;br /&gt;
&lt;br /&gt;
== Overview of Rules  ==&lt;br /&gt;
&lt;br /&gt;
ReNamer has an extensive set of rules. These rules can be combined together, in a logical sequence, to perform nearly any thinkable operation with the filename. You can also [[ReNamer:Manual editing|manually edit]] the name of any file. &lt;br /&gt;
&lt;br /&gt;
The table below lists all rules, with a brief description of each rule. &amp;lt;br&amp;gt;The subsequent chapters provide more details for each rule (follow the links). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Rules &lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Insert|Insert]] &lt;br /&gt;
| Insert the specified text into the filename: as prefix, as suffix, at the specified position, before- or after the specified text. There is also an option to insert meta tags into the filename.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Delete|Delete]] &lt;br /&gt;
| Delete a portion of the filename, usually defined by character positions: from the specified position, from the occurrence of the specified delimiter, until the specified number of characters, until occurrence of the specified delimiter or till the end. This rule can be set to process the filename in a right-to-left manner.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Remove|Remove]] &lt;br /&gt;
| Remove the specified text from the filename: first, last or all occurrences. Optionally, wildcards can be used within this rule, to remove masked text fragments.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Replace|Replace]] &lt;br /&gt;
| This rule is very much like the &#039;&#039;&#039;Remove &#039;&#039;&#039;rule (above). It has similar options, except that instead of removing the text fragments, it will replace them with the specified text.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Rearrange|Rearrange]] &lt;br /&gt;
| Chop up the existing file name using any delimiter or position and reuse any/all of the parts in any order to compose a new name.Add your strings, or use the meta tags extracted from the file to compose the new name.&amp;lt;br&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Extension|Extension]] &lt;br /&gt;
| Change extension of files to the specified extension, or to the extension automatically detected through the internal database of binary signatures.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Strip|Strip]] &lt;br /&gt;
| Strip all occurrences of the specified characters from the filename. This rule has predefined character sets, like digits, symbols, brackets, but you can also define your own character set.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Case|Case]] &lt;br /&gt;
| Change the case of the filename: capitalize each word, to lower case, to upper case, invert case, or capitalize only the first letter and force the rest to lowercase (as in a sentence). There is also an option to force case for the manually entered fragments, for example: CD, DVD, India, ReNamer, etc.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Serialize|Serialize]] &lt;br /&gt;
| Add incremental numbers to put filenames into an order.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Randomize|Randomize]]&lt;br /&gt;
| Add randomly generated sequences into filenames.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:CleanUp|CleanUp]] &lt;br /&gt;
| Cleanup filenames from (or for) commonly used naming conventions for Internet, peer-to-peer networks, and other resources.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:Translit|Translit]] &lt;br /&gt;
| Transliterate Non-English characters from different languages into their English/Latin representation. Useful for preparing files for network storage and transfer. Several transliteration maps are built in, and you can define your own maps.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:RegEx|RegEx]] &lt;br /&gt;
| &lt;br /&gt;
RegEx (=Regular Expressions) is used for complex pattern/expression matching and replacing operations. &amp;lt;br&amp;gt;Although it may look complex at first, you can learn it quite easily, using the guide provided in this manual! &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:PascalScript|PascalScript]] &lt;br /&gt;
| Scripting allows programming-aware users to code their own renaming rule using predefined set of functions. This rule uses Pascal/Delphi programming syntax and conventions. Extremely powerful feature in the right hands.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:UserInput|UserInput]] &lt;br /&gt;
| Rule that simply sets the new names of the files to the names entered in a list (one name per line).&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:ReformatDate|ReformatDate]] &lt;br /&gt;
| Change format of date/time values in the filename.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Rules:CSV-Import|CSV-Import]] &lt;br /&gt;
| Import file names from text-list (CSV or TXT).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=3372</id>
		<title>ReNamer:Rules:UserInput</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=3372"/>
		<updated>2020-04-21T08:56:55Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added an hint for Export menu &amp;gt; Import from CSV&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:PascalScript|next=ReNamer:Rules:ReformatDate}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Image:UserInputRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule replaces the original filenames with the names taken from the list. (The &#039;&#039;n&#039;&#039;th line in the list serves as the new name for the &#039;&#039;n&#039;&#039;th file in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane.) &lt;br /&gt;
&lt;br /&gt;
Naturally, the list should contain names for all the files loaded in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane. &lt;br /&gt;
&lt;br /&gt;
*If the list is shorter, then some of the files will not be renamed. &lt;br /&gt;
*If the list is longer, some of the names will remain unused (but all files in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane will be renamed).&lt;br /&gt;
&lt;br /&gt;
There are three ways to create the list: &lt;br /&gt;
&lt;br /&gt;
#Click in the pane, and manually type the list (one name per line). &lt;br /&gt;
#Copy the list from any application to your clipboard. Switch to ReNamer. Click in the &#039;&#039;&#039;UserInput&#039;&#039;&#039; pane and press &#039;&#039;&#039;CTRL+V&#039;&#039;&#039;, right-click and select &#039;&#039;&#039;Paste&#039;&#039;&#039; or choose the &#039;&#039;&#039;Load from clipboard&#039;&#039;&#039; from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
#Load a list from the text file (available from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
&lt;br /&gt;
The optional parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Insert in front of the current name &lt;br /&gt;
| Inserts the name before the file name.&lt;br /&gt;
|-&lt;br /&gt;
| Insert after the current name &lt;br /&gt;
| Inserts the name &#039;&#039;after&#039;&#039; the current name. The actual position depends on the &#039;&#039;&#039;Skip extension&#039;&#039;&#039; option.&lt;br /&gt;
|-&lt;br /&gt;
| Replace the current name &lt;br /&gt;
| Replaces the existing filename with the new name. &lt;br /&gt;
The effect on extension depends on the &#039;&#039;&#039;&#039;&#039;Skip extension&#039;&#039;&#039;&#039;&#039; option: &lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
|&lt;br /&gt;
*If the option is selected, the extension is ignored and user input strings will affect only the base name of files.&lt;br /&gt;
*If the option is deselected, user input strings will replace entire filename, &#039;&#039;including&#039;&#039; the extension, or will be added &#039;&#039;after&#039;&#039; the old extension (if the &#039;&#039;&#039;Insert after the current name&#039;&#039;&#039; option is selected).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Alternatives ==&lt;br /&gt;
See Export menu  &amp;lt;BR&amp;gt;&lt;br /&gt;
There is an &amp;quot;Import files from text-list CSV TXT&amp;quot; option&amp;lt;BR&amp;gt;&lt;br /&gt;
http://www.den4b.com/wiki/ReNamer:Export_menu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
For example, if you have this three files:&lt;br /&gt;
* Old name 1&lt;br /&gt;
* Old name 2&lt;br /&gt;
* Old name 3&lt;br /&gt;
&lt;br /&gt;
Then your list of new names should contain exactly three lines like:&lt;br /&gt;
* New name for old name 1&lt;br /&gt;
* new name for old name 2&lt;br /&gt;
* New name for old name 3&lt;br /&gt;
&lt;br /&gt;
==== Example 1 ====&lt;br /&gt;
&lt;br /&gt;
File list is longer then the list of new names:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| &#039;&#039;(will not be renamed)&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example 2 ====&lt;br /&gt;
&lt;br /&gt;
List of new names is longer then the file list:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;(not used)&#039;&#039;&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Example 3 ==== &lt;br /&gt;
&lt;br /&gt;
Missed item in the list of new names can cause incorrect ordering:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name&lt;br /&gt;
! List of new names&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| Fifth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:RegEx&amp;diff=3287</id>
		<title>ReNamer:Rules:RegEx</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:RegEx&amp;diff=3287"/>
		<updated>2019-03-13T09:33:37Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added &amp;quot;BackReference explanations&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:Translit|next=ReNamer:Rules:PascalScript}}&lt;br /&gt;
&lt;br /&gt;
[[Image:RegExRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule finds text that matches the specified RegEx pattern, and replaces it with another string. RegEx is short for &#039;&#039;&#039;Regular Expressions&#039;&#039;&#039;, which stands for special syntax for describing search and replace patterns. Regular Expressions are very powerful and they are &#039;&#039;really&#039;&#039; worth learning. The [[ReNamer:Regular Expressions|RegEx syntax]] is explained in the appendix. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The [http://www.regexpstudio.com/ TRegExpr] RegEx engine used by ReNamer is a little different from the standard [http://perldoc.perl.org/perlre.html PERL RegEx] or [http://msdn.microsoft.com/en-us/library/6wzad2b2(VS.85).aspx Windows RegEx]. You may check the correct syntax in [[ReNamer:Regular Expressions|Regular Expressions]] section.&lt;br /&gt;
&lt;br /&gt;
The parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter &lt;br /&gt;
! Details&lt;br /&gt;
|-&lt;br /&gt;
| Expression &lt;br /&gt;
| RegEx pattern to match or find.&lt;br /&gt;
|-&lt;br /&gt;
| Replace &lt;br /&gt;
| RegEx pattern that replaces the found pattern.&lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
| If this check box is selected, the extension will be ignored by the rule.&lt;br /&gt;
|-&lt;br /&gt;
| Case-sensitive &lt;br /&gt;
| If this option is selected, ReNamer will search for the text in &#039;&#039;case-sensitive&#039;&#039; manner.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A simple set of commonly used RegEx syntax patterns is provided in the hint menu:&lt;br /&gt;
&lt;br /&gt;
[[File:RegExRuleSyntaxHint.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tip:&#039;&#039;&#039; ReNamer users have posted many RegEx patterns at the [http://www.den4b.com/forum/ User Forum]. You can copy and use them.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
== BackReference ==&lt;br /&gt;
Replace-Hint: Use $1...$9 to reference subexpressions.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&#039;$n&#039; refers to &#039;BackReference&#039; of RegularExpression search&amp;amp;replace,&amp;lt;BR&amp;gt;&lt;br /&gt;
where you can group a search pattern in parentheses (...) &amp;lt;BR&amp;gt;&lt;br /&gt;
and reuse --what was matched and stored-- later on in replacement.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&#039;$n&#039; would then be used in form of &#039;$1&#039;, &#039;$2&#039;, &#039;$3&#039;,... and so on till &#039;$9&#039;, &amp;lt;BR&amp;gt;&lt;br /&gt;
counting the opening parentheses &#039;(&#039; from the left of the search string.&amp;lt;BR&amp;gt;&lt;br /&gt;
Counting &#039;(&#039; from the left includes nested parentheses: ( 1 xxx (2 dd)(3 ff))&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Example on string &amp;quot;Vacation 2019.ext&amp;quot; &amp;lt;BR&amp;gt;&lt;br /&gt;
Search Expression: &amp;quot;^(\w+) (\d+)\.(\w\w\w)&amp;quot; &amp;lt;BR&amp;gt;&lt;br /&gt;
Replace: &amp;quot;$2 - $1.$3&amp;lt;BR&amp;gt;&lt;br /&gt;
Results in: &amp;quot;2019 - Vacation.ext&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
A little bit to complicated, as you also could use &amp;quot;[x]Skip Extension&amp;quot;, instead of &amp;quot;\.(\w\w\w)&amp;quot; and .$3,&amp;lt;BR&amp;gt;&lt;br /&gt;
but just for example that may be fine to have something to explain.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
In this simple constellation this will work fine, and the two parts are swapped and a hyphen is added in between as we told in the replacement.&amp;lt;BR&amp;gt;&lt;br /&gt;
For more complex issues you may make yourself more familiar with the RegularExpression syntax (see links above), or ask for help in the forum.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that replacement with both &#039;$1&#039; and digit &#039;0&#039; ( &#039;$10&#039; ) could be troublesome, as the engine may look for a tenth subexpression.&amp;lt;BR&amp;gt;&lt;br /&gt;
Maybe use a workaround like &#039;$1_0&#039; and replace the underscore in a second step.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
There is also a second meaning/use of &#039;BackReference&#039; in an Search expression: &amp;quot;(The )$1&amp;quot; for to search for two successively &#039;The &#039;s.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Replace&amp;diff=3286</id>
		<title>ReNamer:Rules:Replace</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Replace&amp;diff=3286"/>
		<updated>2019-03-13T09:11:04Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added &amp;quot;Use &amp;#039;$n&amp;#039; as &amp;#039;Backreferences&amp;#039;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:Remove|next=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
== Replace Rule ==&lt;br /&gt;
&lt;br /&gt;
[[Image:ReplaceRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule removes the specified string from the name and replaces it with another string. It has options to replace the first occurrence, the last occurrence, or all the occurrences. You can replace multiple strings at a time. You can create a pattern with wildcards, so that any string that matches the pattern will be removed. &lt;br /&gt;
&lt;br /&gt;
The parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter &lt;br /&gt;
! Details&lt;br /&gt;
|-&lt;br /&gt;
| Find &lt;br /&gt;
| Enter the string to be replaced. &lt;br /&gt;
*You can enter multiple strings at a time. They will be searched &amp;amp;amp; replaced in the order as they appear. Press the + button to insert a separator between two strings. Instead of pressing this button, you can also enter &#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039; from the keyboard. &lt;br /&gt;
*If the name does not contain the specified string, the rule will not act on it. &lt;br /&gt;
*If the name contains more than one of these strings, it will replace them according to the Occurrences parameter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| [[Image:PlusButton.png]] button &lt;br /&gt;
| Inserts a separator (&#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039;) sequence between two delimiter entries. (You can directly type&#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039; &lt;br /&gt;
You can use this button in the &#039;&#039;&#039;Replace&#039;&#039;&#039; box also. In that case, the nthe entry in the &#039;&#039;&#039;Find&#039;&#039;&#039; box is replaced by the nths entry in the &#039;&#039;&#039;Replace&#039;&#039;&#039; box. (e.g. A --&amp;amp;gt;A&#039;, B --&amp;amp;gt;B&#039; etc.) } &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Replace &lt;br /&gt;
| Enter strings that will replace the &amp;quot;Find&amp;quot; strings. &lt;br /&gt;
*Note that the number of strings (separated with &#039;&#039;&#039;*&amp;amp;#124;*&#039;&#039;&#039;) in &amp;quot;Find&amp;quot; and &amp;quot;Replace&amp;quot; boxes should be the same. If there is more strings in the &amp;quot;Find&amp;quot; box than in the &amp;quot;Replace&amp;quot; box the spare strings will be removed (replaced with an empty string). If there is more strings in the &amp;quot;Replace&amp;quot; box, the spare strings will be ignored.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| Insert meta tag &lt;br /&gt;
[[Image:ReNamer Insert Meta Tag Button.png]] &lt;br /&gt;
&lt;br /&gt;
| Click the button to see a list of [[ReNamer:Meta Tags|meta-tags]].&lt;br /&gt;
|-&lt;br /&gt;
| Occurrences &lt;br /&gt;
| In case that strings occur more than once in the filename, specify which occurrences should be replaced. (Options are: &#039;&#039;first only&#039;&#039;, &#039;&#039;last only&#039;&#039;, or &#039;&#039;all&#039;&#039;)&lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
| If this check box is selected, the extension will be ignored by the rule.&lt;br /&gt;
|-&lt;br /&gt;
| Case sensitive &lt;br /&gt;
| Will only remove a specified string from the name if the case matches exactly.&lt;br /&gt;
|-&lt;br /&gt;
| Interpret symbols as wild cards &lt;br /&gt;
| Treat certain symbols as [[#Wildcards|Wildcards]] for matching simple patterns (similar to [[ReNamer:Regular Expressions|Regular Expressions]]). &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Wildcards ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Wildcard&lt;br /&gt;
! Represents&lt;br /&gt;
! Example&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;*&amp;lt;/center&amp;gt; &lt;br /&gt;
| any number of characters (including numbers, space, underscores, etc.). &lt;br /&gt;
| &#039;&#039;&#039;abc*&#039;&#039;&#039; equals &#039;&#039;&#039;abc&#039;&#039;&#039; followed by 0 or more characters.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;?&amp;lt;/center&amp;gt; &lt;br /&gt;
| Any single character (including numbers, space, underscores, etc.) &lt;br /&gt;
| &#039;&#039;&#039;ab?d&#039;&#039;&#039; equals &#039;&#039;&#039;abcd&#039;&#039;&#039;, &#039;&#039;&#039;ab1d&#039;&#039;&#039;, &#039;&#039;&#039;ab d&#039;&#039;&#039;, &#039;&#039;&#039;ab_d&#039;&#039;&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;[]&amp;lt;/center&amp;gt; &lt;br /&gt;
| Brackets enclose a set of characters, any one of which may match a single character at that position. &lt;br /&gt;
| &#039;&#039;&#039;foo[ab]ar &#039;&#039;&#039;equals &#039;&#039;&#039;fooaar&#039;&#039;&#039; and &#039;&#039;&#039;foobar&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;center&amp;gt;-&amp;lt;/center&amp;gt; &lt;br /&gt;
| (only within a pair of brackets) denotes a range of characters. &lt;br /&gt;
| &#039;&#039;&#039;foo[a-z]ar &#039;&#039;&#039;equals &#039;&#039;&#039;fooaar&#039;&#039;&#039;, &#039;&#039;&#039;foobar,&#039;&#039;&#039; &#039;&#039;&#039;foocar,&#039;&#039;&#039; &#039;&#039;&#039;foodar,&#039;&#039;&#039; etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Use &#039;$n&#039; as &#039;Backreferences&#039; ====&lt;br /&gt;
&lt;br /&gt;
Use what is found by wildcards in replacement with &#039;$n&#039; as &#039;Backreferences&#039;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
If you search with wildcards &#039;?&#039; or &#039;*&#039;, you can use what is found in search, in the replacement by using &#039;$n&#039; variables. &amp;lt;BR&amp;gt;  &lt;br /&gt;
The &#039;n&#039; in &#039;$n&#039; represents the counter as digit, counted from the left as you have used wildcards. &amp;lt;BR&amp;gt;  &lt;br /&gt;
For the first used wildcard it&#039;s &#039;$1&#039; in the replacement, for the second it&#039;s &#039;$2&#039;...  &amp;lt;BR&amp;gt;  &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For example&amp;lt;BR&amp;gt;&lt;br /&gt;
on &amp;quot;ReNamer.exe&amp;quot;,&amp;lt;BR&amp;gt;&lt;br /&gt;
Find: r?n*&amp;lt;BR&amp;gt;&lt;br /&gt;
Replace: -$1-$2-&amp;lt;BR&amp;gt;&lt;br /&gt;
[x] Interpret symbols as wild cards&amp;lt;BR&amp;gt;&lt;br /&gt;
will result in: &amp;quot;-e-amer-.exe&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
the &#039;?&#039; will find the first &#039;e&#039; of &amp;quot;ReNamer&amp;quot; (as searched between &#039;r&#039; and &#039;n&#039;),&amp;lt;BR&amp;gt;&lt;br /&gt;
and the &#039;*&#039; find the rest after the &#039;n&#039; till the end, resulting in &#039;amer&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
On &amp;quot;Vacation 2019.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Find: * *&amp;lt;BR&amp;gt;&lt;br /&gt;
Replace: $2 - $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[x] Interpret symbols as wild cards&amp;lt;BR&amp;gt;&lt;br /&gt;
will result in &amp;quot;2019 - Vacation.txt&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
the &#039;*&#039; will find any amount of signs and store them in $1,&amp;lt;BR&amp;gt;&lt;br /&gt;
but stops on next space, as  we wanted to find a space next,&amp;lt;BR&amp;gt;&lt;br /&gt;
followed by another &#039;*&#039;, now stored in $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
In this simple constellation this will work fine, and the two parts are swapped&amp;lt;BR&amp;gt;&lt;br /&gt;
and a hyphen is added in between as we told so in the replacement.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For more complex issues you may better use a full featured RegularExpression rule.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Beware of conflicting replacements == &lt;br /&gt;
&lt;br /&gt;
If you enter multiple find and replace strings they will be executed as multiple Replace rules, so first string will go first and only after replacing all (or first, or last) occurrences of that string the second string in the Find box will be searched &amp;amp; replaced.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Find&lt;br /&gt;
! Replace&lt;br /&gt;
|-&lt;br /&gt;
| A{{Pipe}}B&lt;br /&gt;
| B{{Pipe}}A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name&lt;br /&gt;
! New Name&lt;br /&gt;
|-&lt;br /&gt;
| ABBA.mp3&lt;br /&gt;
| AAAA.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may expect the new name to be &amp;lt;tt&amp;gt;BAAB.mp3&amp;lt;/tt&amp;gt;, but it&#039;s not. This happens because first all &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;&#039;s are replaced with &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;&#039;s (we get &amp;lt;tt&amp;gt;BBBB.mp3&amp;lt;/tt&amp;gt;) and only then all &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;&#039;s are replaced with &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;&#039;s (and the final result is &amp;lt;tt&amp;gt;AAAA.mp3&amp;lt;/tt&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
If you need to apply character-to-character mappings you should use [[ReNamer:Rules:Translit|Translit rule]].&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Functions&amp;diff=3282</id>
		<title>ReNamer:Pascal Script:Functions</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Functions&amp;diff=3282"/>
		<updated>2019-01-06T09:10:23Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add example to WideCopy()&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Pascal Script|prev=ReNamer:Pascal Script:Types}}&lt;br /&gt;
&lt;br /&gt;
ReNamer has many functions to manipulate the entities related to file names and do some more complex tasks for individual files. These entities may be derived from the existing filename, path, system date, meta tags from the file, strings entered by the user, etc. This functionality is available for use via the [[ReNamer:Rules:PascalScript|PascalScript rule]].&lt;br /&gt;
&lt;br /&gt;
The difference between a &amp;quot;function&amp;quot; and a &amp;quot;procedure&amp;quot; is that while a function executes an algorithm and returns a value, a procedure just executes an algorithm without returning anything.&lt;br /&gt;
&lt;br /&gt;
A common prefix &#039;&#039;&#039;Wide&#039;&#039;&#039; in the function name indicates that the function deals with [[Unicode]] strings (WideString). ReNamer has similar functions without &#039;&#039;&#039;Wide&#039;&#039;&#039; prefix, for processing &#039;&#039;&#039;ANSI&#039;&#039;&#039; strings. For example, &#039;&#039;&#039;ShowMessage&#039;&#039;&#039; and &#039;&#039;&#039;WideShowMessage&#039;&#039;&#039; procedures.&lt;br /&gt;
&lt;br /&gt;
== Basic String Handling ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Routine&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;Insert&#039;&#039;&#039;(Source: String; var S: String; Index: Integer); &lt;br /&gt;
| Inserts the string &#039;&#039;&#039;S&#039;&#039;&#039; into string &#039;&#039;&#039;Source&#039;&#039;&#039; at position &#039;&#039;&#039;Index&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;Delete&#039;&#039;&#039;(var S: String; Index, Count: Integer); &lt;br /&gt;
| Deletes &#039;&#039;&#039;Count&#039;&#039;&#039; characters from the string &#039;&#039;&#039;S&#039;&#039;&#039;, starting from position &#039;&#039;&#039;Index&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Copy&#039;&#039;&#039;(S: String; Index, Count: Integer): String; &lt;br /&gt;
| Copies &#039;&#039;&#039;Count&#039;&#039;&#039; characters from string &#039;&#039;&#039;S&#039;&#039;&#039;, starting at position &#039;&#039;&#039;Index&#039;&#039;&#039;, and returns them as a new string.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Pos&#039;&#039;&#039;(Substr: String; S: String): Integer; &lt;br /&gt;
| Returns the position of a string &#039;&#039;&#039;Substr&#039;&#039;&#039; in another string &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Indexes of characters in strings are 1 based, so first character in string S would be S[1].&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Length Management ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Routine&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;SetLength&#039;&#039;&#039;(var S: Array; NewLength: Integer); &lt;br /&gt;
| Sets the length of array variable &#039;&#039;&#039;S&#039;&#039;&#039; to &#039;&#039;&#039;NewLength&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;SetLength&#039;&#039;&#039;(var S: String; NewLength: Integer); &lt;br /&gt;
| Sets the length of string variable &#039;&#039;&#039;S&#039;&#039;&#039; to &#039;&#039;&#039;NewLength&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;SetLength&#039;&#039;&#039;(var S: WideString; NewLength: Integer); &lt;br /&gt;
| Sets the length of widestring &#039;&#039;&#039;S&#039;&#039;&#039; to &#039;&#039;&#039;NewLength&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Length&#039;&#039;&#039;(const S: Array): Integer; &lt;br /&gt;
| Returns the length of array &#039;&#039;&#039;S &#039;&#039;&#039; (number of elements).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Length&#039;&#039;&#039;(const S: String): Integer; &lt;br /&gt;
| Returns the length of string &#039;&#039;&#039;S&#039;&#039;&#039; (number of characters).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Length&#039;&#039;&#039;(const S: WideString): Integer;&lt;br /&gt;
| Returns the length of WideString &#039;&#039;&#039;S&#039;&#039;&#039; (number of characters).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Unicode String Handling ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Routine&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideInsert&#039;&#039;&#039;(const Substr: WideString; var Dest: WideString; Index: Integer); &lt;br /&gt;
| Inserts &#039;&#039;&#039;Substr&#039;&#039;&#039; in &#039;&#039;&#039;Dest&#039;&#039;&#039; at position &#039;&#039;&#039;Index&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideDelete&#039;&#039;&#039;(var S: WideString; Index, Count: Integer); &lt;br /&gt;
| Deletes &#039;&#039;&#039;Count&#039;&#039;&#039; characters from &#039;&#039;&#039;S&#039;&#039;&#039;, starting from the &#039;&#039;&#039;Index&#039;&#039;&#039; position.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideDeleteRight&#039;&#039;&#039;(var S: WideString; Index, Count: Integer);&lt;br /&gt;
| Delete &#039;&#039;&#039;Count&#039;&#039;&#039; characters from &#039;&#039;&#039;S&#039;&#039;&#039;, starting from the &#039;&#039;&#039;Index&#039;&#039;&#039; position from the end and counting towards the start.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.9 Alpha.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideSetLength&#039;&#039;&#039;(var S: WideString; NewLength: Integer); &lt;br /&gt;
| Change the length of string &#039;&#039;&#039;S&#039;&#039;&#039; to a new length specified by &#039;&#039;&#039;NewLength&#039;&#039;&#039;. If new length is smaller than original, the string is truncated. If new length is greater than original, the string will be expanded but additional characters will not be initialized and can be anything.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideLength&#039;&#039;&#039;(const S: WideString): Integer; &lt;br /&gt;
| Returns the length of WideString &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCopy&#039;&#039;&#039;(const S: WideString; Index, Count: Integer): WideString; &lt;br /&gt;
| Returns &#039;&#039;&#039;Count&#039;&#039;&#039; characters from &#039;&#039;&#039;S&#039;&#039;&#039;, starting at position &#039;&#039;&#039;Index&#039;&#039;&#039;. (Index is zero based)&amp;lt;br&amp;gt;Example: myVarFirst4Signs:=WideCopy(FileName,0,4);&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCopyRight&#039;&#039;&#039;(const S: WideString; Index, Count: Integer): WideString;&lt;br /&gt;
| Returns &#039;&#039;&#039;Count&#039;&#039;&#039; characters from &#039;&#039;&#039;S&#039;&#039;&#039;, starting at position &#039;&#039;&#039;Index&#039;&#039;&#039; from the end and counting towards the start.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.9 Alpha.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WidePos&#039;&#039;&#039;(const SubStr, S: WideString): Integer; &lt;br /&gt;
| Find and occurrence of &#039;&#039;&#039;SubStr&#039;&#039;&#039; in &#039;&#039;&#039;S&#039;&#039;&#039;. Returns the position of first occurrence, or &#039;&#039;&#039;0&#039;&#039;&#039; if nothing was found.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WidePosEx&#039;&#039;&#039;(const SubStr, S: WideString; Offset: Cardinal): Integer; &lt;br /&gt;
| Find and occurrence of &#039;&#039;&#039;SubStr&#039;&#039;&#039; in &#039;&#039;&#039;S&#039;&#039;&#039; but start searching from position specified by &#039;&#039;&#039;Offset&#039;&#039;&#039;. Returns the position of first occurrence, or &#039;&#039;&#039;0&#039;&#039;&#039; if nothing was found.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideUpperCase&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| Returns the ALLCAPS version of the WideString &#039;&#039;&#039;S&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideLowerCase&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| Returns the lowercase version of the WideString &#039;&#039;&#039;S&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCompareStr&#039;&#039;&#039;(const S1, S2: WideString): Integer; &lt;br /&gt;
| Compares two WideStrings &#039;&#039;&#039;S1&#039;&#039;&#039; and &#039;&#039;&#039;S2&#039;&#039;&#039;, case-sensitive, and returns an integer based on the result. The return value is less than 0 if S1 is less than S2, 0 if S1 equals S2, or greater than 0 if S1 is greater than S2.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCompareText&#039;&#039;&#039;(const S1, S2: WideString): Integer; &lt;br /&gt;
| Compares two WideStrings &#039;&#039;&#039;S1&#039;&#039;&#039; and &#039;&#039;&#039;S2&#039;&#039;&#039;, case-insensitive, and returns an integer based on the result. The return value is less than 0 if S1 is less than S2, 0 if S1 equals S2, or greater than 0 if S1 is greater than S2.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideSameText&#039;&#039;&#039;(const S1, S2: WideString): Boolean; &lt;br /&gt;
| Compares two WideStrings &#039;&#039;&#039;S1&#039;&#039;&#039; and &#039;&#039;&#039;S2&#039;&#039;&#039;, case-insensitive. Returns TRUE if both are identical, otherwise returns FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTextPos&#039;&#039;&#039;(const SubStr, S: WideString): Integer; &lt;br /&gt;
| Behaves like &#039;&#039;&#039;WidePos&#039;&#039;&#039; function, except text if processed in case-insensitive manner.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTextPosEx&#039;&#039;&#039;(const SubStr, S: WideString; Offset: Cardinal): Integer;&lt;br /&gt;
| Behaves like &#039;&#039;&#039;WidePosEx&#039;&#039;&#039; function, except text if processed in case-insensitive manner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.6.0.1 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTrim&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| Removes leading and trailing spaces and control characters from the given string &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTrimChars&#039;&#039;&#039;(const S, CharsToTrim: WideString): WideString;&lt;br /&gt;
| Remove characters that occur in &#039;&#039;&#039;CharsToTrim&#039;&#039;&#039; from the beginning and the end of &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.9 Alpha.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTrimCharsLeft&#039;&#039;&#039;(const S, CharsToTrim: WideString): WideString;&lt;br /&gt;
| Remove characters that occur in &#039;&#039;&#039;CharsToTrim&#039;&#039;&#039; from the beginning of &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.9 Alpha.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideTrimCharsRight&#039;&#039;&#039;(const S, CharsToTrim: WideString): WideString;&lt;br /&gt;
| Remove characters that occur in &#039;&#039;&#039;CharsToTrim&#039;&#039;&#039; from the end of &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.9 Alpha.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideReverseString&#039;&#039;&#039;(const S: WideString): WideString;&lt;br /&gt;
| Return a reversed version of string &#039;&#039;&#039;S&#039;&#039;&#039;, i.e. reverse the order of characters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.7.0.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideRepeatString&#039;&#039;&#039;(const S: WideString; Count: Integer): WideString;&lt;br /&gt;
| Repeat a string a number of times.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.9.0.3 Beta.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideReplaceStr&#039;&#039;&#039;(const S, OldPattern, NewPattern: WideString): WideString; &lt;br /&gt;
| Return a result of a &#039;&#039;case-sensitive&#039;&#039; replacement of all occurrences of &#039;&#039;&#039;OldPattern&#039;&#039;&#039; with &#039;&#039;&#039;NewPattern&#039;&#039;&#039; in a string &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideReplaceText&#039;&#039;&#039;(const S, OldPattern, NewPattern: WideString): WideString; &lt;br /&gt;
| Return a result of a &#039;&#039;case-insensitive&#039;&#039; replacement of all occurrences of &#039;&#039;&#039;OldPattern&#039;&#039;&#039; with &#039;&#039;&#039;NewPattern&#039;&#039;&#039; in a string &#039;&#039;&#039;S&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideSplitString&#039;&#039;&#039;(const Input, Delimiter: WideString): TWideStringArray; &lt;br /&gt;
| &lt;br /&gt;
Splits the &#039;&#039;&#039;Input&#039;&#039;&#039; wherever &#039;&#039;&#039;Delimiter&#039;&#039;&#039; occurs and returns an array that contains the split parts. &lt;br /&gt;
&lt;br /&gt;
*The &#039;&#039;&#039;Delimiter&#039;&#039;&#039; itself can be a multi-character WideString. &amp;lt;br&amp;gt;(Unlike the usual comma, hyphen or space that are used for this purpose) &lt;br /&gt;
*The split parts (returned as elements of the array) do not contain the &#039;&#039;&#039;Delimiter&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| function  &#039;&#039;&#039;WideJoinStrings&#039;&#039;&#039;(const Strings: TWideStringArray; const Delimiter: WideString): WideString;&lt;br /&gt;
| Joins all individual items from &#039;&#039;&#039;Strings&#039;&#039;&#039; into a single WideString, with &#039;&#039;&#039;Delimiter&#039;&#039;&#039; inserted between the joined items.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCaseSentence&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| Returns a &#039;&#039;Sentence case&#039;&#039; version of parameter &#039;&#039;&#039;S&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Only the first alphabetic character is capitalized. All other alphabetic characters are converted to lowercase.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.0.0.3 Alpha&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCaseCapitalize&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| &lt;br /&gt;
Returns the &#039;&#039;Title case&#039;&#039; version of parameter &#039;&#039;&#039;S&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
First letter of every word is capitalized. All other alphabetic characters are converted to lowercase.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCaseInvert&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| Inverts case of all characters in &#039;&#039;&#039;S&#039;&#039;&#039; and returns it.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Unicode Character Handling ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharUpper&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is in UPPERCASE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharLower&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is in lowercase.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharDigit&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a digit (numeric character 0-9). &lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharSpace&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a white-space character, such as: space, form-feed, newline, carriage-return, tab and vertical-tab (characters classified as C1_SPACE).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharPunct&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a punctuation mark (characters classified as C1_PUNCT).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharCntrl&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a control character (characters classified as C1_CNTRL).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharBlank&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a blank, such as: space and tab (characters classified as C1_BLANK).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharXDigit&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a hexadecimal digit (0-9 or A-F).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharAlpha&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a alphanumeric character (a-z or A-Z).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideCharAlphaNumeric&#039;&#039;&#039;(WC: WideChar): Boolean; &lt;br /&gt;
| Checks a Unicode character &#039;&#039;&#039;WC&#039;&#039;&#039; and returns TRUE if it is a alphanumeric character or a numeric character (a-z, A-Z or 0-9).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideWordBoundaryLeft&#039;&#039;&#039;(const Subject: WideString; CharPosition: Integer): Boolean;&lt;br /&gt;
| Check if a character at the specified position is on a word boundary to the left.&lt;br /&gt;
&lt;br /&gt;
Conditions that qualify as word boundaries to the left of character:&lt;br /&gt;
# If first character and is a word character.&lt;br /&gt;
# Between word and not a word character.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.6.0.1 Beta.&#039;&#039;   &lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsWideWordBoundaryRight&#039;&#039;&#039;(const Subject: WideString; CharPosition: Integer): Boolean;&lt;br /&gt;
| Check if a character at the specified position is on a word boundary to the right.&lt;br /&gt;
&lt;br /&gt;
Conditions that qualify as word boundaries to the right of character:&lt;br /&gt;
# If last character and is a word character.&lt;br /&gt;
# Between word and not a word character.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.6.0.1 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCharUpper&#039;&#039;&#039;(const WC: WideChar): WideChar; &lt;br /&gt;
| Returns a UPPERCASE version of the input Unicode character. In case of non-alphabetic character, it returns the same character.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCharLower&#039;&#039;&#039;(const WC: WideChar): WideChar; &lt;br /&gt;
| Returns a lowercase version of the input Unicode character. In case of non-alphabetic character, it returns the same character.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideChr&#039;&#039;&#039;(Code: Word): WideChar;&lt;br /&gt;
| Create a Unicode character from a code point.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.9.0.3 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Character classifications, such as C1_UPPER, C1_LOWER, C1_DIGIT, C1_SPACE, C1_PUNCT, C1_CNTRL, C1_BLANK, C1_XDIGIT, C1_ALPHA - are part of Unicode definitions. More information regarding classification can be found on the internet. For example: [http://www.fileformat.info/info/unicode/ http://www.fileformat.info/info/unicode/].&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Unicode Conversion ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideToAnsi&#039;&#039;&#039;(const WS: WideString): String; &lt;br /&gt;
| Converts a [[Unicode]] string to its [[ANSI]] version.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;AnsiToWide&#039;&#039;&#039;(const S: String): WideString; &lt;br /&gt;
| Converts a [[ANSI]] string to its [[Unicode]] version.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;UTF8Encode&#039;&#039;&#039;(const WS: WideString): String; &lt;br /&gt;
| Convert [[Unicode]] string to the [http://en.wikipedia.org/wiki/UTF-8 UTF-8] encoded string.&amp;lt;br/&amp;gt;Useful for storing Unicode strings in files, sometimes for compatibility reasons and sometimes to reduce the size of the file.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;UTF8Decode&#039;&#039;&#039;(const S: String): WideString;&lt;br /&gt;
| Convert [http://en.wikipedia.org/wiki/UTF-8 UTF-8] encoded string to its full [[Unicode]] representation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Console Output Conversion ==&lt;br /&gt;
&lt;br /&gt;
OEM-defined character set is commonly used in the output of console applications.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;OemToAnsi&#039;&#039;&#039;(const S: String): String;&lt;br /&gt;
| Convert OEM string into an ANSI string.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.6.0.2 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;OemToWide&#039;&#039;&#039;(const S: String): WideString;&lt;br /&gt;
| Convert OEM string into a WideString.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.6.0.2 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;AnsiToOem&#039;&#039;&#039;(const S: String): String;&lt;br /&gt;
| Convert ANSI string into an OEM string.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.6.0.2 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideToOem&#039;&#039;&#039;(const S: WideString): String;  &lt;br /&gt;
| Convert WideString into an OEM string.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.6.0.2 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Basic Conversion ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;BoolToStr&#039;&#039;&#039;(B: Boolean): String;&lt;br /&gt;
| Convert boolean variable into a string. Returns &amp;quot;&#039;&#039;True&#039;&#039;&amp;quot; or &amp;quot;&#039;&#039;False&#039;&#039;&amp;quot; string value.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IntToStr&#039;&#039;&#039;(Value: Integer): String; &lt;br /&gt;
| Converts an integer to a string. The following assumptions are correct:&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-family: monospace&amp;quot;&amp;gt;&lt;br /&gt;
* IntToStr(123) = &#039;123&#039;&lt;br /&gt;
* IntToStr(0123) = &#039;123&#039;&lt;br /&gt;
* IntToStr(123) &amp;lt;&amp;gt; &#039;0123&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; Be cautious of supplying &#039;&#039;Int64&#039;&#039; type as a parameter as it will be type casted to &#039;&#039;Integer&#039;&#039;, which significantly reduces the range of possible values (refer to [[ReNamer:Pascal Script:Types|Types]] for more information). You can use &#039;&#039;&#039;FormatFloat&#039;&#039;&#039; function to convert &#039;&#039;Int64&#039;&#039; values to a string without a loss of range.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Int64ToStr&#039;&#039;&#039;(Value: Int64): String;&lt;br /&gt;
| Same as &#039;&#039;&#039;IntToStr&#039;&#039;&#039; but takes in &#039;&#039;Int64&#039;&#039; typed parameter.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToInt&#039;&#039;&#039;(const S: String): Integer; &lt;br /&gt;
| Converts a string to an integer. The following equalities are correct:&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-family: monospace&amp;quot;&amp;gt;&lt;br /&gt;
* StrToInt(&#039;123&#039;) = 123&lt;br /&gt;
* StrToInt(&#039;123&#039;) = 0123&lt;br /&gt;
* StrToInt(&#039;0123&#039;) = 123&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; An error will occur if the parameter to this function cannot be converted to an integer!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToInt64&#039;&#039;&#039;(const S: String): Int64;&lt;br /&gt;
| Same as &#039;&#039;&#039;StrToInt&#039;&#039;&#039; but returns &#039;&#039;Int64&#039;&#039; typed result.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToIntDef&#039;&#039;&#039;(const S: String; const Default: Integer): Integer; &lt;br /&gt;
| Behaves like &#039;&#039;&#039;StrToInt&#039;&#039;&#039; function, but instead of producing an error on incorrect input function allows the &#039;&#039;&#039;Default&#039;&#039;&#039; value to be specified, which will be returned if the input cannot be converted to an integer.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToInt64Def&#039;&#039;&#039;(const S: String; Default: Int64): Int64;&lt;br /&gt;
| Same as &#039;&#039;&#039;StrToIntDef&#039;&#039;&#039; but operates with &#039;&#039;Int64&#039;&#039; type.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;TryStrToInt&#039;&#039;&#039;(const S: String; out Value: Integer): Boolean;&lt;br /&gt;
| Converts a string to an integer, but does not throw an error when invalid string is supplied, unlike &#039;&#039;&#039;StrToInt&#039;&#039;&#039;. Returns &#039;&#039;False&#039;&#039; if conversion operation has failed.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FloatToStr&#039;&#039;&#039;(Value: Extended): string;&lt;br /&gt;
| Converts supplied floating point value to its string representation, using default system format.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToFloat&#039;&#039;&#039;(const S: string): Extended;&lt;br /&gt;
| Converts supplied string to a floating point value.&amp;lt;br&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; An error will occur if the parameter to this function cannot be converted to a floating point value!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToFloatDef&#039;&#039;&#039;(const S: string; const Default: Extended): Extended;&lt;br /&gt;
| Behaves like &#039;&#039;&#039;StrToFloat&#039;&#039;&#039; function, but instead of producing an error on incorrect input function allows the &#039;&#039;&#039;Default&#039;&#039;&#039; value to be specified, which will be returned if the input cannot be converted to a floating point value.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FormatFloat&#039;&#039;&#039;(const Format: string; Value: Extended): string;&lt;br /&gt;
| Converts supplied floating point value to its string representation, using user specific &#039;&#039;&#039;Format&#039;&#039;&#039;.&amp;lt;br/&amp;gt;Check [[#Floating point format specifiers|floating point format specifiers]] below for more information.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DateToStr&#039;&#039;&#039;(D: TDateTime): String; &lt;br /&gt;
| Converts a date to a string, using system format for the short date, for example: &#039;&#039;&#039;dd/mm/yyyy&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;StrToDate&#039;&#039;&#039;(const S: String): TDateTime; &lt;br /&gt;
| Converts a date string to a proper TDateTime value, using system format for the short date, for example: &#039;&#039;&#039;dd/mm/yyyy&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IntToHex&#039;&#039;&#039;(Value: Integer; Digits: Integer): String; &lt;br /&gt;
| Converts an integer to its hexadecimal representation. Here are samples:&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-family: monospace&amp;quot;&amp;gt;&lt;br /&gt;
* IntToHex(1234, 1) = &#039;4D2&#039;&lt;br /&gt;
* IntToHex(1234, 8) = &#039;000004D2&#039;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;HexToInt&#039;&#039;&#039;(const HexNum: String): Integer; &lt;br /&gt;
| Converts a hexadecimal value to its decimal representation.&amp;lt;br/&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; An error will occur if the parameter to this function cannot be converted to an integer!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;HexToIntDef&#039;&#039;&#039;(const HexNum: String; Default: Integer): Integer; &lt;br /&gt;
| Behaves like &#039;&#039;&#039;HexToInt&#039;&#039;&#039; function, but instead of producing an error on incorrect input function allows the &#039;&#039;&#039;Default&#039;&#039;&#039; value to be specified, which will be returned if the input cannot be converted to an integer.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Ord&#039;&#039;&#039;(X: Char): Byte; &lt;br /&gt;
| Return an ordinal value (byte representation) of a character.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Chr&#039;&#039;&#039;(X: Byte): Char; &lt;br /&gt;
| Return a character by its ordinal value (byte representation).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Floating point format specifiers ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Specifier&lt;br /&gt;
! Represents&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt;&amp;amp;nbsp;(zero)&lt;br /&gt;
| Digit placeholder. If the value being formatted has a digit in the position where the &amp;quot;0&amp;quot; appears in the format string, then that digit is copied to the output string. Otherwise, a &amp;quot;0&amp;quot; is stored in that position in the output string.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;&amp;amp;nbsp;(hash)&lt;br /&gt;
| Digit placeholder. If the value being formatted has a digit in the position where the &amp;quot;#&amp;quot; appears in the format string, then that digit is copied to the output string. Otherwise, nothing is stored in that position in the output string.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt;&amp;amp;nbsp;(dot)&lt;br /&gt;
| Decimal point. The first &amp;quot;.&amp;quot; character in the format string determines the location of the decimal separator in the formatted value, any additional &amp;quot;.&amp;quot; characters are ignored.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;,&amp;lt;/tt&amp;gt;&amp;amp;nbsp;(comma)&lt;br /&gt;
| Thousand separator. If the format string contains one or more &amp;quot;,&amp;quot; characters, the output will have thousand separators inserted between each group of three digits to the left of the decimal point. The placement and number of &amp;quot;,&amp;quot; characters in the format string does not affect the output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Date and Time ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Date&#039;&#039;&#039;: TDateTime; &lt;br /&gt;
| Returns the current system date.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Time&#039;&#039;&#039;: TDateTime; &lt;br /&gt;
| Returns the current system time.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Now&#039;&#039;&#039;: TDateTime; &lt;br /&gt;
| Returns the current system date and time.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;EncodeDate&#039;&#039;&#039;(Year, Month, Day: Word): TDateTime; &lt;br /&gt;
| Generates date value for the specified &#039;&#039;&#039;Year&#039;&#039;&#039;, &#039;&#039;&#039;Month&#039;&#039;&#039;, &#039;&#039;&#039;Day&#039;&#039;&#039;. Parameters must be within a valid date range: Year = 0..9999, Month = 1..12, Day = 1..31 (depending on month/year). An error will be raised if parameters are invalid.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;EncodeTime&#039;&#039;&#039;(Hour, Min, Sec, MSec: Word): TDateTime; &lt;br /&gt;
| Generates time value for the specified &#039;&#039;&#039;Hour&#039;&#039;&#039;, &#039;&#039;&#039;Min&#039;&#039;&#039;, &#039;&#039;&#039;Sec&#039;&#039;&#039;, &#039;&#039;&#039;MSec&#039;&#039;&#039;. Parameters must be within a valid time range: Hour = 0..23, Min = 0..59, Sec = 0..59, MSec = 0..999. An error will be raised if parameters are invalid.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;EncodeDateTime&#039;&#039;&#039;(Year, Month, Day, Hour, Minute, Second, MilliSecond: Word): TDateTime;&lt;br /&gt;
| Generates date-time value for the specified components of date and time. Similar to &#039;&#039;&#039;EncodeDate&#039;&#039;&#039; and &#039;&#039;&#039;EncodeTime&#039;&#039;&#039;.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.5 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;TryEncodeDate&#039;&#039;&#039;(Year, Month, Day: Word; var Date: TDateTime): Boolean; &lt;br /&gt;
| Behaves exactly like &#039;&#039;&#039;EncodeDate&#039;&#039;&#039; function, except this function returns &#039;&#039;TRUE&#039;&#039; or &#039;&#039;FALSE&#039;&#039; depending on the success of the operation. If operation was successful, function will return &#039;&#039;TRUE&#039;&#039; and the generated date value will be written in the &#039;&#039;&#039;Date&#039;&#039;&#039; variable.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;TryEncodeTime&#039;&#039;&#039;(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean; &lt;br /&gt;
| Behaves exactly like &#039;&#039;&#039;EncodeTime&#039;&#039;&#039; function, except this function returns &#039;&#039;TRUE&#039;&#039; or &#039;&#039;FALSE&#039;&#039; depending on the success of the operation. If operation was successful, function will return &#039;&#039;TRUE&#039;&#039; and the generated time value will be written in the &#039;&#039;&#039;Time&#039;&#039;&#039; variable.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;TryEncodeDateTime&#039;&#039;&#039;(Year, Month, Day, Hour, Minute, Second, MilliSecond: Word; out ADateTime: TDateTime): Boolean;&lt;br /&gt;
| Behaves exactly like &#039;&#039;&#039;EncodeDateTime&#039;&#039;&#039; function, except this function returns &#039;&#039;TRUE&#039;&#039; or &#039;&#039;FALSE&#039;&#039; depending on the success of the operation. If operation was successful, function will return &#039;&#039;TRUE&#039;&#039; and the generated date-time value will be written in the &#039;&#039;&#039;ADateTime&#039;&#039;&#039; variable.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.5 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;DecodeDate&#039;&#039;&#039;(const DateTime: TDateTime; var Year, Month, Day: Word); &lt;br /&gt;
| Extracts &#039;&#039;&#039;Year&#039;&#039;&#039;, &#039;&#039;&#039;Month&#039;&#039;&#039; and &#039;&#039;&#039;Day&#039;&#039;&#039; components from a given &#039;&#039;&#039;DateTime&#039;&#039;&#039; value.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;DecodeTime&#039;&#039;&#039;(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word); &lt;br /&gt;
| Extracts &#039;&#039;&#039;Hour&#039;&#039;&#039;, &#039;&#039;&#039;Min&#039;&#039;&#039;, &#039;&#039;&#039;Sec&#039;&#039;&#039; and &#039;&#039;&#039;MSec&#039;&#039;&#039; components from a given &#039;&#039;&#039;DateTime&#039;&#039;&#039; value.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;DecodeDateTime&#039;&#039;&#039;(const DateTime: TDateTime; out Year, Month, Day, Hour, Minute, Second, MilliSecond: Word);&lt;br /&gt;
| Similar to &#039;&#039;&#039;DecodeDate&#039;&#039;&#039; and &#039;&#039;&#039;DecodeTime&#039;&#039;&#039; but extracts both date and time components at once.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.5 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ComposeDateTime&#039;&#039;&#039;(const Date, Time: TDateTime): TDateTime;&lt;br /&gt;
| Combine date and time components into a single date-time value.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.5 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DateTimeToUnix&#039;&#039;&#039;(D: TDateTime): Int64;&lt;br /&gt;
| Converts &#039;&#039;&#039;D&#039;&#039;&#039; value of type &#039;&#039;&#039;TDateTime&#039;&#039;&#039; to a Unix timestamp.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;UnixToDateTime&#039;&#039;&#039;(U: Int64): TDateTime; &lt;br /&gt;
| Converts a Unix timestamp to a value of &#039;&#039;&#039;TDateTime&#039;&#039;&#039; type.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FormatDateTime&#039;&#039;&#039;(const Fmt: String; D: TDateTime): String; &lt;br /&gt;
| This function provides rich formatting of a &#039;&#039;&#039;DateTime&#039;&#039;&#039; value into a string. [[ReNamer:Date and Time format|Date and time format]] is defined by the &#039;&#039;&#039;Fmt&#039;&#039;&#039; string. &lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncYear&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfYears: Integer): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of years (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncMonth&#039;&#039;&#039;(const AValue: TDateTime; ANumberOfMonths: Integer): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of months (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncWeek&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfWeeks: Integer): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of weeks (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncDay&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfDays: Integer): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of days (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncHour&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfHours: Int64): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of hours (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncMinute&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfMinutes: Int64): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of minutes (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncSecond&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfSeconds: Int64): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of seconds (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IncMilliSecond&#039;&#039;&#039;(const AValue: TDateTime; const ANumberOfMilliSeconds: Int64): TDateTime; &lt;br /&gt;
| Increments a TDateTime variable by a number of milliseconds (plus or minus).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;SecondSpan&#039;&#039;&#039;(const ANow, AThen: TDateTime): Double;&lt;br /&gt;
| Calculate the approximate number of seconds between two date-time values.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.5 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DayOfWeek&#039;&#039;&#039;(const DateTime: TDateTime): Word; &lt;br /&gt;
| Returns the day number of the week. Returned values: 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, 7 = Sunday.&amp;lt;br/&amp;gt;&#039;&#039;Before v6.1 this function used to return 1=Sunday to 7=Saturday.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DayOfMonth&#039;&#039;&#039;(const DateTime: TDateTime): Word;&lt;br /&gt;
| Returns the day number of the month.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.1.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DayOfYear&#039;&#039;&#039;(const DateTime: TDateTime): Word;&lt;br /&gt;
| Returns the day number of the year.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.1.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WeekOfMonth&#039;&#039;&#039;(const DateTime: TDateTime): Word;&lt;br /&gt;
| Returns the week number of the month.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.1.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WeekOfYear&#039;&#039;&#039;(const DateTime: TDateTime): Word;&lt;br /&gt;
| Returns the week number of the year.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.1.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== File Management ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideFileSize&#039;&#039;&#039;(const FileName: WideString): Int64; &lt;br /&gt;
| Returns the size of the file in bytes. If file does not exist &amp;quot;-1&amp;quot; is returned. The return value is of type &#039;&#039;Int64&#039;&#039; which can store the maximum file size of 9,223,372,036,854,775,807 bytes.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideFileExists&#039;&#039;&#039;(const FileName: WideString): Boolean; &lt;br /&gt;
| Check whether specified file exists. Returns TRUE if file exists, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideDirectoryExists&#039;&#039;&#039;(const Directory: WideString): Boolean; &lt;br /&gt;
| Check whether specified directory exists. Returns TRUE if directory exists, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideForceDirectories&#039;&#039;&#039;(const Dir: WideString): Boolean; &lt;br /&gt;
| Makes sure that that all directories in the path exist. If they don&#039;t, function will try to create them, recursively. Returns TRUE if all folders exist or have been successfully created.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCreateDir&#039;&#039;&#039;(const Dir: WideString): Boolean; &lt;br /&gt;
| Create specified directory (non-recursive). Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideRemoveDir&#039;&#039;&#039;(const Dir: WideString): Boolean;&lt;br /&gt;
| Remove a directory, if it is empty. Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.4.0.1 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideDeleteFile&#039;&#039;&#039;(const FileName: WideString): Boolean; &lt;br /&gt;
| Delete physical file from the disk. Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideDeleteToRecycleBin&#039;&#039;&#039;(const FileName: WideString): Boolean;&lt;br /&gt;
| Delete file or folder by placing it into the Recycle Bin. Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; You must provide a full path to delete the file to the Recycle Bin (a quirk of Windows API).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.4.0.1 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideRenameFile&#039;&#039;&#039;(const OldName, NewName: WideString): Boolean; &lt;br /&gt;
| Rename file from &#039;&#039;&#039;OldName&#039;&#039;&#039; to &#039;&#039;&#039;NewName&#039;&#039;&#039;. Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideCopyFile&#039;&#039;&#039;(const FromFile, ToFile: WideString; FailIfExists: Boolean): Boolean;&lt;br /&gt;
| Rename file from &#039;&#039;&#039;FromFile&#039;&#039;&#039; to &#039;&#039;&#039;ToFile&#039;&#039;&#039;. If &#039;&#039;&#039;FailIfExists&#039;&#039;&#039; flag is TRUE, file will not be copied when destination file already exists, otherwise, destination file will be overwritten. Returns TRUE on success, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideFileSearch&#039;&#039;&#039;(const Name, DirList: WideString): WideString; &lt;br /&gt;
| Search through the directories passed in &#039;&#039;&#039;DirList&#039;&#039;&#039; for a file named &#039;&#039;&#039;Name&#039;&#039;&#039;. DirList is a list of path names delimited by semicolons. If file matching Name is located, function returns a string specifying a path name for that file. If no matching file exists, function returns an empty string.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideScanDirForFiles&#039;&#039;&#039;(const Dir: WideString; var Files: TWideStringArray; const Recursive, IncludeHidden, IncludeSystem: Boolean; const Mask: WideString); &lt;br /&gt;
| You can get a list of the files inside a folder.&lt;br /&gt;
*&#039;&#039;&#039;Dir&#039;&#039;&#039;: The folder you want to scan.&lt;br /&gt;
*&#039;&#039;&#039;Files&#039;&#039;&#039;: Where the list of files is going to be saved.&lt;br /&gt;
*&#039;&#039;&#039;Recursive&#039;&#039;&#039;: Do you want to scan the subfolders?&lt;br /&gt;
*&#039;&#039;&#039;IncludeHidden&#039;&#039;&#039;: Do you want to list the hidden files?&lt;br /&gt;
*&#039;&#039;&#039;IncludeSystem&#039;&#039;&#039;: Do you want to list the system files?&lt;br /&gt;
*&#039;&#039;&#039;Mask&#039;&#039;&#039;: List only the files which match a [[ReNamer:Masks|wildcard mask]], or specify an empty string to list all files.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideScanDirForFolders&#039;&#039;&#039;(const Dir: WideString; var Folders: TWideStringArray; const Recursive, IncludeHidden, IncludeSystem: Boolean); &lt;br /&gt;
| You can get a list of the folders inside other folder.&lt;br /&gt;
*&#039;&#039;&#039;Dir&#039;&#039;&#039;: The folder you want to scan.&lt;br /&gt;
*&#039;&#039;&#039;Folders&#039;&#039;&#039;: Where the list of folders is going to be saved.&lt;br /&gt;
*&#039;&#039;&#039;Recursive&#039;&#039;&#039;: Do you want to scan the subfolders?&lt;br /&gt;
*&#039;&#039;&#039;IncludeHidden&#039;&#039;&#039;: Do you want to list the hidden folders?&lt;br /&gt;
*&#039;&#039;&#039;IncludeSystem&#039;&#039;&#039;: Do you want to list the system folders?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== File Name Utilities ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractFilePath&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the drive and directory portion from &amp;quot;FileName&amp;quot;, including the trailing path delimiter, e.g. &amp;quot;C:\Folder\&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractFileDir&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the drive and directory portion from &amp;quot;FileName&amp;quot;, excluding the trailing path delimiter, e.g. &amp;quot;C:\Folder&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractFileDrive&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the drive letter, e.g. &amp;quot;C:&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractFileName&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the filename with extension, e.g. &amp;quot;FileName.txt&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractBaseName&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the base name of the file, i.e. file name without extension and path components.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Input&lt;br /&gt;
! Output&lt;br /&gt;
|-&lt;br /&gt;
| Document.txt&lt;br /&gt;
| Document&lt;br /&gt;
|-&lt;br /&gt;
| C:\Folder\Document.txt&lt;br /&gt;
| Document&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractFileExt&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Returns the file&#039;s extension with the dot, e.g. &amp;quot;.txt&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideChangeFileExt&#039;&#039;&#039;(const FileName, Extension: WideString): WideString; &lt;br /&gt;
| Replaces the original extension, and returns the new filename with extension, e.g. &amp;quot;FineName.txt&amp;quot; -&amp;amp;gt; &amp;quot;FineName.pdf&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideStripExtension&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Strips off the extension from the filename, maintaining the path component unaffected.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Input&lt;br /&gt;
! Output&lt;br /&gt;
|-&lt;br /&gt;
| Document.txt&lt;br /&gt;
| Document&lt;br /&gt;
|-&lt;br /&gt;
| C:\Folder\Document.txt&lt;br /&gt;
| C:\Folder\Document&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExpandFileName&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| Converts the relative file name into a fully qualified path. This function does not verify that the resulting path refers to an existing file.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractRelativePath&#039;&#039;&#039;(const BaseName, DestName: WideString): WideString; &lt;br /&gt;
| Creates a relative path to go from &#039;&#039;&#039;BaseName&#039;&#039;&#039; to &#039;&#039;&#039;DestName&#039;&#039;&#039;. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| &#039;&#039;&#039;BaseName:&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;C:\Folder\FileName.txt&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DestName:&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;C:\Documents\Article.pdf&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Result:&#039;&#039;&#039;&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;..\Documents\Article.pdf&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExtractShortPathName&#039;&#039;&#039;(const FileName: WideString): WideString; &lt;br /&gt;
| It converts a path into it&#039;s representation in DOS format.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideIncludeTrailingPathDelimiter&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| With this function you can ensure that a path for a folder &#039;&#039;&#039;contains&#039;&#039;&#039; the path delimiter (&amp;quot;\&amp;quot;) at the end of the path.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideExcludeTrailingPathDelimiter&#039;&#039;&#039;(const S: WideString): WideString; &lt;br /&gt;
| With this function you can ensure that a path for a file does &#039;&#039;&#039;not contain&#039;&#039;&#039; the path delimiter (&amp;quot;\&amp;quot;) at the end of the path.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideSameFileName&#039;&#039;&#039;(const FileName1, FileName2: WideString): Boolean;&lt;br /&gt;
| Compares the filenames &#039;&#039;&#039;FileName1&#039;&#039;&#039; and &#039;&#039;&#039;FileName2&#039;&#039;&#039;, and returns &#039;&#039;TRUE&#039;&#039; if they are considered to be same.&lt;br /&gt;
&lt;br /&gt;
Note that filenames on Windows platform are case insensitive for comparison purposes, but case preserving when creating new files.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.7.0.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideMatchesMask&#039;&#039;&#039;(const FileName, Mask: WideString): Boolean;&lt;br /&gt;
| Check if &#039;&#039;&#039;FileName&#039;&#039;&#039; matches a [[ReNamer:Masks|wildcard mask]] &#039;&#039;&#039;Mask&#039;&#039;&#039;. Return &#039;&#039;TRUE&#039;&#039; if matches, otherwise &#039;&#039;FALSE&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For example, a mask &amp;lt;code&amp;gt;*.txt&amp;lt;/code&amp;gt; matches files with a &amp;lt;code&amp;gt;.txt&amp;lt;/code&amp;gt; extension.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.7.0.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideMatchesMaskList&#039;&#039;&#039;(const FileName, MaskList: WideString): Boolean;&lt;br /&gt;
| Check if &#039;&#039;&#039;FileName&#039;&#039;&#039; matches any of the [[ReNamer:Masks|wildcard masks]] listed in &#039;&#039;&#039;MaskList&#039;&#039;&#039;. The list of masks is separated by semicolons (&amp;quot;;&amp;quot;). Return &#039;&#039;TRUE&#039;&#039; if matches, otherwise &#039;&#039;FALSE&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For example, a mask list &amp;lt;code&amp;gt;*.txt;*.doc&amp;lt;/code&amp;gt; matches files with a &amp;lt;code&amp;gt;.txt&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;.doc&amp;lt;/code&amp;gt; extension.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v6.7.0.4 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== File Read/Write ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadFragment&#039;&#039;&#039;(const FileName: WideString; Start, Length: Integer): String; &lt;br /&gt;
| Starting at position &#039;&#039;&#039;Start&#039;&#039;&#039;, read &#039;&#039;&#039;Length&#039;&#039;&#039; number of characters of the file &#039;&#039;&#039;FileName&#039;&#039;&#039; and return them as a string. &#039;&#039;&#039;Start&#039;&#039;&#039; is 0-based, so in order to start the fragment at the beginning of the file, set this parameter to 0 (zero).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadLines&#039;&#039;&#039;(const FileName: WideString): TAnsiStringArray;&lt;br /&gt;
| Read all lines from a file &#039;&#039;&#039;FileName&#039;&#039;&#039;.&amp;lt;br/&amp;gt;&#039;&#039;Added in v5.74.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadLine&#039;&#039;&#039;(const FileName: WideString; LineNum: Integer): String; &lt;br /&gt;
| Read a line from a file &#039;&#039;&#039;FileName&#039;&#039;&#039; specified by a line index &#039;&#039;&#039;LineNum&#039;&#039;&#039;. &#039;&#039;&#039;LineNum&#039;&#039;&#039; is 1 based, so to get the first line set this parameter to 1 (one).&amp;lt;br/&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; This function is extremely inefficient and provided only for convenience!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileCountLines&#039;&#039;&#039;(const FileName: WideString): Integer; &lt;br /&gt;
| Count number of lines in the file.&amp;lt;br/&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; This function is extremely inefficient and provided only for convenience!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadContent&#039;&#039;&#039;(const FileName: WideString): String; &lt;br /&gt;
| Return the entire content of the file as a String.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;FileWriteContent&#039;&#039;&#039;(const FileName: WideString; const Content: String); &lt;br /&gt;
| Write &#039;&#039;&#039;Content&#039;&#039;&#039; to the file. If target file already exists, it will be overwritten.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;FileAppendContent&#039;&#039;&#039;(const FileName: WideString; const Content: String); &lt;br /&gt;
| Append &#039;&#039;&#039;Content&#039;&#039;&#039; to the end of the file. If target file does not exist, it will be created.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadText&#039;&#039;&#039;(const FileName: WideString): WideString;&lt;br /&gt;
| Read text from a file, performing automatic text encoding handling.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.6.0.6 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileReadTextLines&#039;&#039;&#039;(const FileName: WideString): TWideStringArray;&lt;br /&gt;
| Read lines of text from a file, performing automatic text encoding handling.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.7.0.1 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: Automatic text encoding handling is based on [https://en.wikipedia.org/wiki/Byte_order_mark byte order mark] (BOM) and supports UTF-8, UTF-16BE and UTF-16LE. If no BOM found then text is interpreted as ANSI encoding.&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== File Time ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileTimeModified&#039;&#039;&#039;(const FileName: WideString): TDateTime; &lt;br /&gt;
| Returns last modified time of the specified file.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;FileTimeCreated&#039;&#039;&#039;(const FileName: WideString): TDateTime; &lt;br /&gt;
| Returns creation time of the specified file.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;SetFileTimeCreated&#039;&#039;&#039;(const FileName: WideString; const DateTime: TDateTime): Boolean; &lt;br /&gt;
| Sets creation time for the specified file.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;SetFileTimeModified&#039;&#039;&#039;(const FileName: WideString; const DateTime: TDateTime): Boolean; &lt;br /&gt;
| Sets last modified time for the specified file.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Meta Tags Extraction  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;CalculateMetaTag&#039;&#039;&#039;(const FilePath: WideString; const MetaTagName: String): WideString; &lt;br /&gt;
| Extracts and returns the value of a meta tag specified by &#039;&#039;&#039;MetaTagName&#039;&#039;&#039; from the file specified by the complete absolute path &#039;&#039;&#039;FilePath&#039;&#039;&#039;.&amp;lt;br/&amp;gt;&#039;&#039;Return type changed from String to WideString in v5.74.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;CalculateMetaTagFormat&#039;&#039;&#039;(const FilePath: WideString; const MetaTagName, DateTimeFormat: String): WideString;&lt;br /&gt;
| Same as &#039;&#039;&#039;CalculateMetaTag&#039;&#039;&#039; except an additional parameter &#039;&#039;&#039;DateTimeFormat&#039;&#039;&#039; is provided to specify custom Date/Time format to be used instead of the application&#039;s default setting.&amp;lt;br/&amp;gt;&#039;&#039;Added in v5.74.4 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For example, to extract &#039;&#039;&#039;EXIF_Date&#039;&#039;&#039; tag from an image and set it to the filename using the default date/time formatting:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
begin&lt;br /&gt;
  FileName := CalculateMetaTag(FilePath, &#039;EXIF_Date&#039;);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full list of meta tags can be found in [[ReNamer:Meta Tags|Meta Tags]] article. For help with date/time formatting refer to [[ReNamer:Date and Time format|Date and Time format]].&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Regular Expressions ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;IsMatchingRegEx&#039;&#039;&#039;(const Input, Pattern: WideString; const CaseSensitive: Boolean): Boolean;&lt;br /&gt;
| Check for a match against a RegEx pattern.&amp;lt;br/&amp;gt;&#039;&#039;Added in v5.74.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ReplaceRegEx&#039;&#039;&#039;(const Input, Find, Replace: WideString; const CaseSensitive, UseSubstitution: Boolean): WideString; &lt;br /&gt;
| Find-and-replace function using RegEx. Works like [[ReNamer:Rules:RegEx|RegEx rule]].&lt;br /&gt;
&lt;br /&gt;
The parameters for this and next RegEx functions are:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039; - The WideString that is input to the function. &lt;br /&gt;
* &#039;&#039;&#039;Find&#039;&#039;&#039; - RegEx pattern to be found (same as &#039;&#039;&#039;Expression&#039;&#039;&#039; field in the [[ReNamer:Rules:RegEx|RegEx rule]]).&lt;br /&gt;
* &#039;&#039;&#039;Replace&#039;&#039;&#039; - Replacement string (same as the &#039;&#039;&#039;Replace&#039;&#039;&#039; field in the [[ReNamer:Rules:RegEx|RegEx rule]]).&lt;br /&gt;
* &#039;&#039;&#039;CaseSensitive&#039;&#039;&#039; - Specifies whether to process in a case-sensitive mode.&lt;br /&gt;
* &#039;&#039;&#039;UseSubstitution&#039;&#039;&#039; - Determines whether use [[ReNamer:Regular Expressions#Backreferences|backreferences]] in the result.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MatchesRegEx&#039;&#039;&#039;(const Input, Find: WideString; const CaseSensitive: Boolean): TWideStringArray; &lt;br /&gt;
| Returns a list of RegEx matches as an array. Function returns an array of full matches, which matched the entire expression, not the sub-patterns. For example:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;150&amp;quot; | Input  &lt;br /&gt;
! width=&amp;quot;100&amp;quot; | Find&lt;br /&gt;
! width=&amp;quot;100&amp;quot; | Results&lt;br /&gt;
|-&lt;br /&gt;
| Ax1_-_Bx2---Cx3 &lt;br /&gt;
| [A-Z]x\d&lt;br /&gt;
| &lt;br /&gt;
* Ax1&lt;br /&gt;
* Bx2&lt;br /&gt;
* Cx3&lt;br /&gt;
|-&lt;br /&gt;
| Ax1_-_Bx2---Cx3 &lt;br /&gt;
| ([A-Z])x(\d)&lt;br /&gt;
| &lt;br /&gt;
* Ax1&lt;br /&gt;
* Bx2&lt;br /&gt;
* Cx3&lt;br /&gt;
|}&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;SubMatchesRegEx&#039;&#039;&#039;(const Input, Find: WideString; const CaseSensitive: Boolean): TWideStringArray; &lt;br /&gt;
| This function is very similar to &#039;&#039;&#039;MatchesRegEx&#039;&#039;&#039;, but instead of returning full matches it will return an array of sub-expression matches for the &#039;&#039;&#039;first&#039;&#039;&#039; full match. For example:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;150&amp;quot; | Input&lt;br /&gt;
! width=&amp;quot;100&amp;quot; | Find&lt;br /&gt;
! width=&amp;quot;100&amp;quot; | Results&lt;br /&gt;
|-&lt;br /&gt;
| Ax1_-_Bx2---Cx3 &lt;br /&gt;
| [A-Z]x\d&lt;br /&gt;
| &#039;&#039;(empty)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| Ax1_-_Bx2---Cx3 &lt;br /&gt;
| ([A-Z])x(\d)&lt;br /&gt;
| &lt;br /&gt;
* A&lt;br /&gt;
* 1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In this way, it can easily be combined with &#039;&#039;&#039;MatchesRegEx&#039;&#039;&#039; function, to allow users to find all global matches, and then parse those matches through &#039;&#039;&#039;SubMatchesRegEx&#039;&#039;&#039; function to find individual sub-expression matches of each global match.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Process Execution ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ShellOpenFile&#039;&#039;&#039;(const FileName: WideString): Boolean; &lt;br /&gt;
| Run (open) a file specified by &#039;&#039;&#039;FileName&#039;&#039;&#039;. Works like &amp;quot;Start &amp;amp;gt; Run&amp;quot; command. Parameter does not have to be an executable file, it can by any file or protocol with assigned handler. For example, you can open a Word document or a web page, and associated application will be launched:&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;ShellOpenFile(&#039;http://www.den4b.com/&#039;);&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;ShellOpenFile(&#039;C:\Document.doc&#039;);&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Beware:&#039;&#039;&#039; This function will evaluate the command for the appropriate way of execution which may sometimes lead to unexpected results. For example when executing &#039;&#039;ShellOpenFile(&#039;notepad&#039;)&#039;&#039; it could actually run a &#039;&#039;Windows Notepad&#039;&#039; application normally located in &amp;quot;&#039;&#039;C:\Windows\notepad.exe&#039;&#039;&amp;quot;, or some other &amp;quot;&#039;&#039;notepad.exe&#039;&#039;&amp;quot; file located on the search path (&#039;&#039;%PATH%&#039;&#039;), or even open &amp;quot;&#039;&#039;notepad&#039;&#039;&amp;quot; folder located in the current working directory.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ExecuteProgram&#039;&#039;&#039;(const Command: String; WaitForProgram: Boolean): Cardinal; &lt;br /&gt;
| Execute a command specified by &#039;&#039;&#039;Command&#039;&#039;&#039; parameter. Parameter &#039;&#039;&#039;WaitForProgram&#039;&#039;&#039; allows you to specify whether the code needs to wait until the command (launched program) has finished executing.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ExecuteProgramShow&#039;&#039;&#039;(const Command: String; WaitForProgram: Boolean; ShowWindowFlag: Word): Cardinal;&lt;br /&gt;
| Execute a command specified by &#039;&#039;&#039;Command&#039;&#039;&#039; parameter. &#039;&#039;&#039;WaitForProgram&#039;&#039;&#039; parameter allows you to specify whether the code needs to wait until the command (launched program) has finished executing. &#039;&#039;&#039;ShowWindowFlag&#039;&#039;&#039; parameter controls how the window is to be shown.&lt;br /&gt;
&lt;br /&gt;
Commonly used values for &#039;&#039;&#039;ShowWindowFlag&#039;&#039;&#039; parameter: &lt;br /&gt;
* 0 = Hide the window.&lt;br /&gt;
* 1 = Activate and display the window.&lt;br /&gt;
* 2 = Activate the window and display it minimized.&lt;br /&gt;
* 3 = Activate the window and display it maximized.&lt;br /&gt;
* 4 = Display the window, but do not activate it.&lt;br /&gt;
* 7 = Display the window minimized, but do not activate it.&lt;br /&gt;
* More information: [http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx ShowWindow Windows API function].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v5.75.3 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;ExecConsoleApp&#039;&#039;&#039;(const CommandLine: String; out Output: String): Cardinal; &lt;br /&gt;
| Execute a command line specified by &#039;&#039;&#039;CommandLine&#039;&#039;&#039; parameter and capture its standard output in the &#039;&#039;&#039;Output&#039;&#039;&#039; variable. This function should be used only for console style applications. Returns the exit code.&lt;br /&gt;
&lt;br /&gt;
Console application output uses OEM-defined character set by default, unless application itself changes its output code page. &#039;&#039;&#039;OemToAnsi&#039;&#039;&#039; and &#039;&#039;&#039;OemToWide&#039;&#039;&#039; functions can be used to convert OEM output.&lt;br /&gt;
&lt;br /&gt;
Prior to &#039;&#039;v6.6.0.2 Beta&#039;&#039;, OEM to ANSI conversion was automatically applied to the console output. As of &#039;&#039;v6.6.0.2 Beta&#039;&#039;, the console output is returned &amp;quot;as is&amp;quot; without any modifications, so to prevent corruption of binary or non-OEM encoded output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Dialogs ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;ShowMessage&#039;&#039;&#039;(const Msg: String); &lt;br /&gt;
| Show a simple dialog with the message specified by &#039;&#039;&#039;Msg&#039;&#039;&#039; parameter.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;WideShowMessage&#039;&#039;&#039;(const Msg: WideString); &lt;br /&gt;
| Same as &#039;&#039;&#039;ShowMessage&#039;&#039;&#039; function but parameter is Unicode text.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;DialogYesNo&#039;&#039;&#039;(const Msg: String): Boolean; &lt;br /&gt;
| Show a simple prompt with the message specified by &#039;&#039;&#039;Msg&#039;&#039;&#039; parameter and two button: Yes and No. Returns TRUE if user clicks Yes button, otherwise FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideDialogYesNo&#039;&#039;&#039;(const Msg: WideString): Boolean; &lt;br /&gt;
| Same as &#039;&#039;&#039;DialogYesNo&#039;&#039;&#039; function but parameter is WideString text.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;InputBox&#039;&#039;&#039;(const ACaption, APrompt, ADefault: String): String; &lt;br /&gt;
| Displays a simple dialog box with the given &#039;&#039;&#039;ACaption&#039;&#039;&#039; and &#039;&#039;&#039;APrompt&#039;&#039;&#039; message. It asks the user to enter data in a text box on the dialog. A &#039;&#039;&#039;ADefault&#039;&#039;&#039; value is displayed in the text box initially. If the user presses OK, the value from the text box is returned, otherwise &#039;&#039;&#039;ADefault&#039;&#039;&#039; value is returned.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;InputQuery&#039;&#039;&#039;(const ACaption, APrompt: String; var Value: String): Boolean; &lt;br /&gt;
| Operates similar to &#039;&#039;&#039;InputBox&#039;&#039;&#039; function. The default value and the value of the text box after the dialog is closed are transferred via the &#039;&#039;&#039;Value&#039;&#039;&#039; parameter. Function returns TRUE is user clicked OK, otherwise returns FALSE.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideInputBox&#039;&#039;&#039;(const ACaption, APrompt, ADefault: WideString): WideString; &lt;br /&gt;
| Same as &#039;&#039;&#039;InputBox&#039;&#039;&#039; function but operates on WideString text.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideInputQuery&#039;&#039;&#039;(const ACaption, APrompt: WideString; var Value: WideString): Boolean; &lt;br /&gt;
| Same as &#039;&#039;&#039;InputQuery&#039;&#039;&#039; function but operates on WideString text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Application ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetApplicationPath&#039;&#039;&#039;: WideString;&lt;br /&gt;
| Return full path to the application, for example: &amp;quot;C:\Program Files\ReNamer\ReNamer.exe&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetApplicationParams&#039;&#039;&#039;: TWideStringArray;&lt;br /&gt;
| Return an array of command line parameters which were supplied to the application at launch.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetCurrentFileIndex&#039;&#039;&#039;: Integer;&lt;br /&gt;
| Get index of the current file. Index ranges from &#039;&#039;&#039;1&#039;&#039;&#039; to &#039;&#039;&#039;GetTotalNumberOfFiles&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetTotalNumberOfFiles&#039;&#039;&#039;: Integer;&lt;br /&gt;
| Get total number of files in the application.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetCurrentMarkedFileIndex&#039;&#039;&#039;: Integer;&lt;br /&gt;
| Get index of the current file, counting only &#039;&#039;marked&#039;&#039; files. Index ranges from &#039;&#039;&#039;1&#039;&#039;&#039; to &#039;&#039;&#039;GetTotalNumberOfMarkedFiles&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetTotalNumberOfMarkedFiles&#039;&#039;&#039;: Integer;&lt;br /&gt;
| Get total number of &#039;&#039;marked&#039;&#039; files in the application.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetAllFiles&#039;&#039;&#039;: TWideStringArray;&lt;br /&gt;
| Get file paths of all available files. &#039;&#039;Added in v5.74.2 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetMarkedFiles&#039;&#039;&#039;: TWideStringArray;&lt;br /&gt;
| Get file paths of all marked files. &#039;&#039;Added in v5.74.2 Beta.&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== System ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideGetCurrentDir&#039;&#039;&#039;: WideString; &lt;br /&gt;
| Returns the current working directory.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideSetCurrentDir&#039;&#039;&#039;(const Dir: WideString): Boolean; &lt;br /&gt;
| Sets the current working directory to the directory specified by parameter &#039;&#039;&#039;Dir&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideGetTempPath&#039;&#039;&#039;: WideString;&lt;br /&gt;
| Returns system defined temporary directory. If returned value is empty it means that temporary folder could not be determined.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;WideGetEnvironmentVar&#039;&#039;&#039;(const VarName: WideString): WideString; &lt;br /&gt;
| Returns an environment variable by its name. For example:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  UserName, ComputerName: WideString;&lt;br /&gt;
begin&lt;br /&gt;
  UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
  ComputerName := WideGetEnvironmentVar(&#039;COMPUTERNAME&#039;);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! Remarks&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;Sleep&#039;&#039;&#039;(Milliseconds: Cardinal); &lt;br /&gt;
| Sleep (pause the execution) for specified number of &#039;&#039;&#039;Milliseconds&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;DivMod&#039;&#039;&#039;(Dividend: Integer; Divisor: Word; var Result, Remainder: Word); &lt;br /&gt;
| Perform integer division and fetch the remainder as well, all in one operation. &#039;&#039;&#039;Dividend&#039;&#039;&#039; is the integer into which you are dividing. &#039;&#039;&#039;Divisor&#039;&#039;&#039; is the value by which to divide &#039;&#039;&#039;Dividend&#039;&#039;&#039;. &#039;&#039;&#039;Result&#039;&#039;&#039; returns the result of the integer division. &#039;&#039;&#039;Remainder&#039;&#039;&#039; returns the remainder (the difference between Result * Divisor and Dividend).&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;Randomize&#039;&#039;&#039;; &lt;br /&gt;
| Prepares the random number generator.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Should only be called once per application cycle, at the start of the process!&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;RandomRange&#039;&#039;&#039;(const AFrom, ATo: Integer): Integer; &lt;br /&gt;
| Return a random integer number within the specified range from &#039;&#039;&#039;AFrom&#039;&#039;&#039; (inclusive) to &#039;&#039;&#039;ATo&#039;&#039;&#039; (non-inclusive).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;RandomFloat&#039;&#039;&#039;: Extended;&lt;br /&gt;
| Return a random floating point value between 0.0 (including) and 1.0 (excluding).&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
| function &#039;&#039;&#039;RandomBoolean&#039;&#039;&#039;: Boolean;&lt;br /&gt;
| Return a random boolean value, either &#039;&#039;True&#039;&#039; or &#039;&#039;False&#039;&#039;.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;RandomString&#039;&#039;&#039;(Len: Integer; const Chars: String): String;&lt;br /&gt;
| Generate a random string of length &#039;&#039;&#039;Len&#039;&#039;&#039; using characters selected at random from a string &#039;&#039;&#039;Chars&#039;&#039;&#039;.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.7.0.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MinInt&#039;&#039;&#039;(const A, B: Integer): Integer;&lt;br /&gt;
| Return the smallest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Integer&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MinInt64&#039;&#039;&#039;(const A, B: Int64): Int64;&lt;br /&gt;
| Return the smallest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Int64&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MinFloat&#039;&#039;&#039;(const A, B: Extended): Extended;&lt;br /&gt;
| Return the smallest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Extended&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MaxInt&#039;&#039;&#039;(const A, B: Integer): Integer;&lt;br /&gt;
| Return the largest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Integer&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MaxInt64&#039;&#039;&#039;(const A, B: Int64): Int64;&lt;br /&gt;
| Return the largest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Int64&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;MaxFloat&#039;&#039;&#039;(const A, B: Extended): Extended;&lt;br /&gt;
| Return the largest of two values &#039;&#039;&#039;A&#039;&#039;&#039; and &#039;&#039;&#039;B&#039;&#039;&#039; of &#039;&#039;Extended&#039;&#039; type.&amp;lt;br/&amp;gt;&#039;&#039;Added in v6.2.0.8 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetClipboardText&#039;&#039;&#039;: WideString; &lt;br /&gt;
| Get the content of the the clipboard (text only).&lt;br /&gt;
|-&lt;br /&gt;
| procedure &#039;&#039;&#039;SetClipboardText&#039;&#039;&#039;(const S: WideString); &lt;br /&gt;
| Set the content of the the clipboard (text only).&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Base64Encode&#039;&#039;&#039;(const S: String): String; &lt;br /&gt;
| Encode string &#039;&#039;&#039;S&#039;&#039;&#039; into [http://en.wikipedia.org/wiki/Base64 Base64]. Useful for encoding binary data in order to minimize the likelihood of data being modified in transit through different systems, like email or internet.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;Base64Decode&#039;&#039;&#039;(const S: String): String; &lt;br /&gt;
| Decode [http://en.wikipedia.org/wiki/Base64 Base64] encoded string.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;URLDecode&#039;&#039;&#039;(const Str: String; UsePlusAsSpace: Boolean): WideString;&lt;br /&gt;
| Decode URL encoded string. All occurrences of &#039;&#039;%XX&#039;&#039; hex format are decoded, then entire string is decoded from UTF8.&lt;br /&gt;
&lt;br /&gt;
Optionally, plus signs (&amp;quot;+&amp;quot;) can be interpreted as white space by enabling &#039;&#039;&#039;UsePlusAsSpace&#039;&#039;&#039; parameter, for compatibility with some encoders such as in [http://php.net/manual/en/function.urlencode.php PHP].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v5.74.4 Beta. UsePlusAsSpace parameter added in v6.7.0.1 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;URLEncode&#039;&#039;&#039;(const Str: WideString; UsePlusAsSpace: Boolean): String;&lt;br /&gt;
| Encode string using URL encoding. Input string is encoded with UTF8, then all characters except digits and Latin letters are encoded in &#039;&#039;%XX&#039;&#039; hex format.&lt;br /&gt;
&lt;br /&gt;
Optionally, white spaces can be encoded as plus signs (&amp;quot;+&amp;quot;) by enabling &#039;&#039;&#039;UsePlusAsSpace&#039;&#039;&#039; parameter, for compatibility with some decoders such as in [http://php.net/manual/en/function.urldecode.php PHP].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Added in v5.74.4 Beta.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;GetTickCount&#039;&#039;&#039;: Cardinal; &lt;br /&gt;
| Retrieves the number of milliseconds that have elapsed since the system was started (up to 49.7 days, then timer resets). The precision of this timer is very limited.&lt;br /&gt;
|-&lt;br /&gt;
| function &#039;&#039;&#039;SizeOf&#039;&#039;&#039;(X): Integer; &lt;br /&gt;
| Pass a variable reference to determine the number of bytes used to represent the variable. Pass a type identifier to determine the number of bytes used to represent instances of that type.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Top}}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;br /&gt;
[[Category:Pascal Script]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3273</id>
		<title>ReNamer:Rules:Rearrange Examples</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3273"/>
		<updated>2018-08-30T19:10:22Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Example 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|prev=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
[[ReNamer:Rules:Rearrange|Rearrange rule]] can be used in many ways. Few examples are given below. &lt;br /&gt;
&lt;br /&gt;
For simplicity&#039;s sake, we have split examples into two sections: [[#Basic usage|Basic usage]] (typical needs of beginners) and [[#Advanced usage|Advanced usage]] (for the power users).&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title.mp3&lt;br /&gt;
| Title - Artist.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; - &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 - $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
Explanation: We split the string at the hyphen (dash or minus sign -) or whatever you use to separate Artist from Title&amp;lt;BR&amp;gt;&lt;br /&gt;
Now, all signs before the dash are stored in variable $1, all after are put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
Because we want to swap this parts, we simple swap the vars in the output, the &amp;quot;New Pattern&amp;quot;: $2 $1&amp;lt;BR&amp;gt;&lt;br /&gt;
And since this rule removes the used delimiter, we add it on our own: &amp;quot;$2 - $1&amp;quot;, or use an new delimiter as e.g.: &amp;quot;$2_-_$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA - Ring Ring&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA -The winner takes it all&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA - $0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&amp;amp;nbsp; &#039;&#039;&#039;is same as the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]] &#039;&#039;&#039;rule.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before and after the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA- Ring Ring (Live)&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA-The winner takes it all (Live)&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA- $0 (Live) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; is same as using the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]]&#039;&#039;&#039; rule &amp;lt;u&amp;gt;twice&amp;lt;/u&amp;gt; (one for adding the prefix, and another for adding the suffix).&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Switch the words, and remove the comma between them. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| King, Stephen &lt;br /&gt;
| Stephen King&lt;br /&gt;
|-&lt;br /&gt;
| Cook, Robin &lt;br /&gt;
| Robin Cook&lt;br /&gt;
|-&lt;br /&gt;
| Pride and Prejudice, The &lt;br /&gt;
| The Pride and Prejudice&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;, &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move a word to a new position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Words sample 1234 07-07-07 &lt;br /&gt;
| 1234 Words sample 07-07-07&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; &amp;quot; (only a space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $3 $1 $2 $4 &lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Get rid of the numbers, hyphen and space at the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 01 - Afilename.zip &lt;br /&gt;
| Afilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 002 - Bfilename.zip &lt;br /&gt;
| Bfilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 0003 - Cfilename.zip &lt;br /&gt;
| Cfilename.zip&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiter contains a space. If only a hyphen is used as delimiter, then a space would be left out in the beginning of the name, which you would have to trim separately. &lt;br /&gt;
#The &#039;&#039;&#039;Delete&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the truncated names.&lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the first part to the end. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| TEST.aaa.bbb.100.ext &lt;br /&gt;
| aaa.bbb.100.TEST.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2.$3.$4.$1&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 8  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the artist&#039;s name from end to the beginning, and change the name format. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring ring_ABBA.mp3 &lt;br /&gt;
| ABBA - Ring Ring.mp3&lt;br /&gt;
|-&lt;br /&gt;
| Material girl_Madonna.mp3 &lt;br /&gt;
| Madonna - Material girl mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 9  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the numbers to the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-1.jpg &lt;br /&gt;
| 1-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-2.jpg &lt;br /&gt;
| 2-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-10.jpg &lt;br /&gt;
| 10-DSC_0001.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;-&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2-$1 &lt;br /&gt;
&lt;br /&gt;
=== Example 10  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert &amp;quot;sent_&amp;quot; before the last 3 digits. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| family_001.jpg &lt;br /&gt;
| family_sent_001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| work_023.jpg &lt;br /&gt;
| work_sent_023.jpg&lt;br /&gt;
|-&lt;br /&gt;
| friend_098.jpg &lt;br /&gt;
| friend_sent_098.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1_sent_$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Insert&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 11  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the name of the artist (delete text until hyphen). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Sting - All This Time.mp3 &lt;br /&gt;
| All This Time.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note the space after the hyphen. If we use just a &amp;quot;-&amp;quot; as delimiter, the second token would be left with a space in front, which we will have to trim separately. &lt;br /&gt;
#Even the &#039;&#039;&#039;Delete&#039;&#039;&#039; rule would have worked (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 12  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the track numbers (and any separator symbol after that) from the beginning of the filenames: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 08. Madonna - Like A Prayer.wma &lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08.-Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08 Madonna - Like A Prayer.wma&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;Madonna&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: Madonna$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks: &#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We chose the string &amp;quot;Madonna&amp;quot; as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes &amp;quot;Madonna&amp;quot; string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string &amp;quot;Madonna&amp;quot; to $2, to restore the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 13  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the number to front, and remove the square brackets. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Name XXX [0001].jpg &lt;br /&gt;
| 0001 - Name XXX.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [|]&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# The &amp;quot;|&amp;quot; (vertical pipe) character is used to separate the two delimiters. &lt;br /&gt;
# The second delimiter &amp;quot;]&amp;quot; will not produce a token. It is included only to remove it from the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 14  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Add composer name and duration to an mp3 file, as prefix and suffix, respectively. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Eine kleine Nachtmusik.mp3 &lt;br /&gt;
| Mozart - Eine kleine Nachtmusik (6.37).mp3&lt;br /&gt;
|-&lt;br /&gt;
| Don Giovanni.mp3 &lt;br /&gt;
| Mozart - Don Giovanni (4.5).mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Positions: 1 &lt;br /&gt;
&lt;br /&gt;
New Order: Mozart - $2 (:Audio_Duration:) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#This can also be done by using the &#039;&#039;&#039;Insert&#039;&#039;&#039; rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule allows you to add both in a single stroke. Besides, you can see the structure of the new name. &lt;br /&gt;
#When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The &#039;&#039;entire&#039;&#039; name is copied into the $2 token. This is a great trick to compose new name using the &#039;&#039;whole&#039;&#039; original name.&lt;br /&gt;
&lt;br /&gt;
=== Example 15  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name at fixed position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport1, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport2.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport2, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport3.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport3, Business.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2, $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since we didn&#039;t have an real delimiter here, we simply split at an position within the string, here e.g. at char number 9:&amp;lt;BR&amp;gt;&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&lt;br /&gt;
&lt;br /&gt;
So all before 9th char is put in variable $1, and all from char number 9 till end of string is put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
That means: $1 holds &#039;Business&#039; and $2 holds &#039;RawReport1&#039;. (Note that we skip the extension, so we don&#039;t have to deal with it)&amp;lt;BR&amp;gt;&lt;br /&gt;
Now we compose our new string, the output pattern, just as we like it to be: &#039;$2, $1&#039;&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
You can also use more then one delimiter or position:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| Raw Business Report1.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9|12&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789012&lt;br /&gt;
&lt;br /&gt;
$1 holds &#039;Business&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$2 holds &#039;Raw&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$3 holds &#039;Report1&#039;&lt;br /&gt;
&lt;br /&gt;
== Advanced usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the string from the file name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title [Time 4 02 Cold] [2004].mpg &lt;br /&gt;
| Artist - Title [2004].mpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [T|d] &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 $3 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#The &#039;&#039;&#039;|&#039;&#039;&#039; character separates the two delimiters. &lt;br /&gt;
#Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens. &lt;br /&gt;
#We have selected two &#039;&#039;different&#039;&#039; delimiters to represent the beginning and the end of the string we want to remove. Thus &#039;&#039;&#039;&#039;&#039;whatever&#039;&#039;&#039;&#039;&#039; lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; The file names contain artist name, album name and track name. Sort them into separate folders as follows: &lt;br /&gt;
&lt;br /&gt;
#Create a separate folder for each artist. &lt;br /&gt;
#For each artist, create a subfolder for each album. &lt;br /&gt;
#Move each file in the corresponding folder.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Title - Artist (Album).mp3 &lt;br /&gt;
| D:\Artist\Album\Title.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; - | (|)&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: D:\$2\$3\$1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiters contain spaces and symbols, so that only text remains in the tokens. &lt;br /&gt;
#The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token. &lt;br /&gt;
#Instead of &#039;&#039;&#039;D:&#039;&#039;&#039; a relative path (such as &#039;&#039;&#039;..\..\&#039;&#039;&#039;) can be added to the front.&lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Sort digital photos in different folders based on the &#039;&#039;&#039;Date taken&#039;&#039;&#039; for each photo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Many people call this operation &amp;quot;binning&amp;quot;, because we segregate the items into separate bins based on some criteria. (most people associate the word &amp;quot;Sorting&amp;quot; with &amp;quot;rearranging the files in ascending/descending order, without moving them to other folders&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0002.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0002.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0003.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_25\DSC_0003.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: - (none)&lt;br /&gt;
&lt;br /&gt;
New pattern: D:\photos\trip\:EXIF_Date:\$0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that this EXIF data is contained in the meta tag of each photo, not in the file name. &lt;br /&gt;
#The meta tag &#039;&#039;&#039;:EXIF_Date:&#039;&#039;&#039; is replaced by the actual &#039;&#039;&#039;date taken&#039;&#039;&#039; for each photo. Thus all photos taken on the same date will be moved to the same folder. &lt;br /&gt;
#The actual name of the folder would depend on the [[ReNamer:Program settings#Meta_tags_settings|Date and Time format settings]].&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.extension &lt;br /&gt;
| title.text1.extension&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.text3.extension &lt;br /&gt;
| title.text1.text2.extension&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; The solution requires a stack of two different rules, as shown below: &lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Replace&#039;&#039;&#039; Rule &lt;br /&gt;
&lt;br /&gt;
Find: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Replace: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;[X] Last&amp;quot; to find and replace last occurrence of an dot only.&amp;lt;br /&amp;gt;&lt;br /&gt;
Check &amp;quot;[X] Skip Extension&amp;quot; to not replace the file/extension separator as last dot.&lt;br /&gt;
&lt;br /&gt;
(this is a temporary change; which will be eliminated in the second step) &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We had to do this indirectly because the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule cannot pick only the last dot as delimiter; and ignore the other dots. So we used a trick: we first changed the last dot into another character (using the &#039;&#039;&#039;Replace&#039;&#039;&#039; rule), and then use that new character as delimiter in the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts with more then one of the same delimiter &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First exchange the first occurrence of the delimiter by an completely other sign, e.g. #&amp;lt;BR&amp;gt;&lt;br /&gt;
* Add an &amp;quot;Replace&amp;quot; Rule&amp;lt;BR&amp;gt;&lt;br /&gt;
* Replace First &amp;quot; - &amp;quot;  with  &amp;quot;#&amp;quot;, [X] Skip Extension&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we got&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; # &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 ($1)&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since this rule removes the used delimiter, we don&#039;t have to take care about them in the output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text3.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-1&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the second last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text1.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-2&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; Since $-1 and $-2 count the tokens from the right (from the end), we will get the same result even if the name is longer. &lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Sort files with same names (but different extensions) into separate subfolder.&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Typically, training websites provide such sets of files for each episode/lecture/lesson, etc. (video, handout, homework, etc.)&amp;lt;br&amp;gt; &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; When you download these files, they are in a single folder. ReNamer helps you in sorting them into separate folders.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
We will see two different variations here:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-1:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is same as the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Episode 001.pdf&amp;lt;br&amp;gt;Episode 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Episode 002.pdf&amp;lt;br&amp;gt;Episode 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Episode 001\Episode 001.pdf&amp;lt;br&amp;gt;Episode 001\Episode 001.mp4 &lt;br /&gt;
&lt;br /&gt;
Episode 002\Episode 002.pdf&amp;lt;br&amp;gt;Episode 002\Episode 002.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using: - (Leave blank)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: $0\$0&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same base name will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-2:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is different as compared to the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Handout 001.pdf&amp;lt;br&amp;gt;Lesson 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Handout 002.pdf&amp;lt;br&amp;gt;Lesson 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Part 001\Handout.pdf&amp;lt;br&amp;gt;Part 001\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
Part 002\Handout.pdf&amp;lt;br&amp;gt; Part 002\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using:&amp;quot; &amp;quot; (space, without the quotes)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: Part $2\$1&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same &#039;&#039;number&#039;&#039; will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder&amp;lt;br&amp;gt;3. The &amp;quot;Part &amp;quot; is a literal string. (note the space at the end) &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Split by positions ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
FROM: &lt;br /&gt;
FECAAFC2309C055D7E7D61C4C669F9C0.dat &lt;br /&gt;
That is:&lt;br /&gt;
 0  1  2  3  4  5  6  7  8 9101112131415 &lt;br /&gt;
FE CA AF C2 30 9C 05 5D 7E7D61C4C669F9C0 &lt;br /&gt;
&lt;br /&gt;
TO:  &lt;br /&gt;
C2AFCAFE9C305D057E7D61C4C669F9C0.dat &lt;br /&gt;
That is:&lt;br /&gt;
 3  2  1  0  5  4  7  6  8 9101112131415 &lt;br /&gt;
C2 AF CA FE 9C 30 5D 05 7E7D61C4C669F9C0 &lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
USE:  &lt;br /&gt;
Rearrange rule:  &amp;lt;BR&amp;gt;&lt;br /&gt;
If you enter position n, ReNamer will chop the n-th character and all characters beyond that in a separate piece.  &amp;lt;BR&amp;gt;&lt;br /&gt;
Split by positions: 3|5|7|9|11|13|15|17  &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $4$3$2$1$6$5$8$7$9  &amp;lt;BR&amp;gt;&lt;br /&gt;
Skip extension: YES  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB-AB-AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$1-$1 &amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB - CD (EFGHI)&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3|5 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 - $2 ($3) &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at pos. 3 till before pos. 5 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Store the rest (silently) in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
AB CD EFGHI &amp;lt;BR&amp;gt;&lt;br /&gt;
12 34 56789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABC - DEF - GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 4|7|10&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$2-$3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Store everything before position 4 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position (4) till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Everything starting at pos. 10 till the end in variable $3  (that ReNamer would do for us too) &amp;lt;BR&amp;gt;&lt;br /&gt;
ABC DEF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
123 456 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 5|7|555&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Store everything before position 5 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at pos. 5 till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
555 = Everything starting at the last position till the end in variable $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have dropped var &#039;$2&#039; in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1234 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
GHI (EF) A BC D&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 2|4|5|7|999&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $5 ($4) $1 $2 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
2 = Store everything before position 2 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Everything starting at the last position (2) till before pos. 4 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at the last position pos. till pos.5 in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position pos. till pos.7 in $4 &amp;lt;BR&amp;gt;&lt;br /&gt;
999 = Everything starting at the last position till the end in variable $5 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have rearranged (switched) the output vars in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
A BC D EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1 23 4 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3272</id>
		<title>ReNamer:Rules:Rearrange Examples</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3272"/>
		<updated>2018-08-30T08:04:04Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Example 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|prev=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
[[ReNamer:Rules:Rearrange|Rearrange rule]] can be used in many ways. Few examples are given below. &lt;br /&gt;
&lt;br /&gt;
For simplicity&#039;s sake, we have split examples into two sections: [[#Basic usage|Basic usage]] (typical needs of beginners) and [[#Advanced usage|Advanced usage]] (for the power users).&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title.mp3&lt;br /&gt;
| Title - Artist.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; - &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 - $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
Explanation: We split the string at the hyphen (dash or minus sign -) or whatever you use to separate Artist from Title&amp;lt;BR&amp;gt;&lt;br /&gt;
Now, all signs before the dash are stored in variable $1, all after are put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
Because we want to swap this parts, we simple swap the vars in the output, the &amp;quot;New Pattern&amp;quot;: $2 $1&amp;lt;BR&amp;gt;&lt;br /&gt;
And since this rule removes the used delimiter, we add it on our own: &amp;quot;$2 - $1&amp;quot;, or use an new delimiter as e.g.: &amp;quot;$2_-_$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA - Ring Ring&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA -The winner takes it all&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA - $0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&amp;amp;nbsp; &#039;&#039;&#039;is same as the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]] &#039;&#039;&#039;rule.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before and after the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA- Ring Ring (Live)&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA-The winner takes it all (Live)&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA- $0 (Live) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; is same as using the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]]&#039;&#039;&#039; rule &amp;lt;u&amp;gt;twice&amp;lt;/u&amp;gt; (one for adding the prefix, and another for adding the suffix).&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Switch the words, and remove the comma between them. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| King, Stephen &lt;br /&gt;
| Stephen King&lt;br /&gt;
|-&lt;br /&gt;
| Cook, Robin &lt;br /&gt;
| Robin Cook&lt;br /&gt;
|-&lt;br /&gt;
| Pride and Prejudice, The &lt;br /&gt;
| The Pride and Prejudice&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;, &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move a word to a new position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Words sample 1234 07-07-07 &lt;br /&gt;
| 1234 Words sample 07-07-07&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; &amp;quot; (only a space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $3 $1 $2 $4 &lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Get rid of the numbers, hyphen and space at the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 01 - Afilename.zip &lt;br /&gt;
| Afilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 002 - Bfilename.zip &lt;br /&gt;
| Bfilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 0003 - Cfilename.zip &lt;br /&gt;
| Cfilename.zip&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiter contains a space. If only a hyphen is used as delimiter, then a space would be left out in the beginning of the name, which you would have to trim separately. &lt;br /&gt;
#The &#039;&#039;&#039;Delete&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the truncated names.&lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the first part to the end. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| TEST.aaa.bbb.100.ext &lt;br /&gt;
| aaa.bbb.100.TEST.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2.$3.$4.$1&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 8  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the artist&#039;s name from end to the beginning, and change the name format. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring ring_ABBA.mp3 &lt;br /&gt;
| ABBA - Ring Ring.mp3&lt;br /&gt;
|-&lt;br /&gt;
| Material girl_Madonna.mp3 &lt;br /&gt;
| Madonna - Material girl mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 9  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the numbers to the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-1.jpg &lt;br /&gt;
| 1-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-2.jpg &lt;br /&gt;
| 2-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-10.jpg &lt;br /&gt;
| 10-DSC_0001.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;-&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2-$1 &lt;br /&gt;
&lt;br /&gt;
=== Example 10  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert &amp;quot;sent_&amp;quot; before the last 3 digits. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| family_001.jpg &lt;br /&gt;
| family_sent_001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| work_023.jpg &lt;br /&gt;
| work_sent_023.jpg&lt;br /&gt;
|-&lt;br /&gt;
| friend_098.jpg &lt;br /&gt;
| friend_sent_098.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1_sent_$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Insert&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 11  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the name of the artist (delete text until hyphen). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Sting - All This Time.mp3 &lt;br /&gt;
| All This Time.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note the space after the hyphen. If we use just a &amp;quot;-&amp;quot; as delimiter, the second token would be left with a space in front, which we will have to trim separately. &lt;br /&gt;
#Even the &#039;&#039;&#039;Delete&#039;&#039;&#039; rule would have worked (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 12  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the track numbers (and any separator symbol after that) from the beginning of the filenames: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 08. Madonna - Like A Prayer.wma &lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08.-Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08 Madonna - Like A Prayer.wma&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;Madonna&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: Madonna$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks: &#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We chose the string &amp;quot;Madonna&amp;quot; as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes &amp;quot;Madonna&amp;quot; string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string &amp;quot;Madonna&amp;quot; to $2, to restore the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 13  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the number to front, and remove the square brackets. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Name XXX [0001].jpg &lt;br /&gt;
| 0001 - Name XXX.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [|]&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# The &amp;quot;|&amp;quot; (vertical pipe) character is used to separate the two delimiters. &lt;br /&gt;
# The second delimiter &amp;quot;]&amp;quot; will not produce a token. It is included only to remove it from the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 14  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Add composer name and duration to an mp3 file, as prefix and suffix, respectively. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Eine kleine Nachtmusik.mp3 &lt;br /&gt;
| Mozart - Eine kleine Nachtmusik (6.37).mp3&lt;br /&gt;
|-&lt;br /&gt;
| Don Giovanni.mp3 &lt;br /&gt;
| Mozart - Don Giovanni (4.5).mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Positions: 1 &lt;br /&gt;
&lt;br /&gt;
New Order: Mozart - $2 (:Audio_Duration:) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#This can also be done by using the &#039;&#039;&#039;Insert&#039;&#039;&#039; rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule allows you to add both in a single stroke. Besides, you can see the structure of the new name. &lt;br /&gt;
#When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The &#039;&#039;entire&#039;&#039; name is copied into the $2 token. This is a great trick to compose new name using the &#039;&#039;whole&#039;&#039; original name.&lt;br /&gt;
&lt;br /&gt;
=== Example 15  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name at fixed position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport1, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport2.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport2, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport3.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport3, Business.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2, $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since we didn&#039;t have an real delimiter here, we simply split at an position within the string, here e.g. at char number 9:&amp;lt;BR&amp;gt;&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&lt;br /&gt;
&lt;br /&gt;
So all before 9th char is put in variable $1, and all from char number 9 till end of string is put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
That means: $1 holds &#039;Business&#039; and $2 holds &#039;RawReport1&#039;. (Note that we skip the extension, so we don&#039;t have to deal with it)&amp;lt;BR&amp;gt;&lt;br /&gt;
Now we compose our new string, the output pattern, just as we like it to be: &#039;$2, $1&#039;&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
You can also use more then one delimiter or position:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| Raw Business Report1.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9|12&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789012&lt;br /&gt;
&lt;br /&gt;
$1 holds &#039;Business&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$2 holds &#039;Raw&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$3 holds &#039;Report1&#039;&lt;br /&gt;
&lt;br /&gt;
== Advanced usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the string from the file name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title [Time 4 02 Cold] [2004].mpg &lt;br /&gt;
| Artist - Title [2004].mpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [T|d] &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 $3 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#The &#039;&#039;&#039;|&#039;&#039;&#039; character separates the two delimiters. &lt;br /&gt;
#Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens. &lt;br /&gt;
#We have selected two &#039;&#039;different&#039;&#039; delimiters to represent the beginning and the end of the string we want to remove. Thus &#039;&#039;&#039;&#039;&#039;whatever&#039;&#039;&#039;&#039;&#039; lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; The file names contain artist name, album name and track name. Sort them into separate folders as follows: &lt;br /&gt;
&lt;br /&gt;
#Create a separate folder for each artist. &lt;br /&gt;
#For each artist, create a subfolder for each album. &lt;br /&gt;
#Move each file in the corresponding folder.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Title - Artist (Album).mp3 &lt;br /&gt;
| D:\Artist\Album\Title.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; - | (|)&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: D:\$2\$3\$1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiters contain spaces and symbols, so that only text remains in the tokens. &lt;br /&gt;
#The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token. &lt;br /&gt;
#Instead of &#039;&#039;&#039;D:&#039;&#039;&#039; a relative path (such as &#039;&#039;&#039;..\..\&#039;&#039;&#039;) can be added to the front.&lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Sort digital photos in different folders based on the &#039;&#039;&#039;Date taken&#039;&#039;&#039; for each photo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Many people call this operation &amp;quot;binning&amp;quot;, because we segregate the items into separate bins based on some criteria. (most people associate the word &amp;quot;Sorting&amp;quot; with &amp;quot;rearranging the files in ascending/descending order, without moving them to other folders&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0002.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0002.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0003.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_25\DSC_0003.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: - (none)&lt;br /&gt;
&lt;br /&gt;
New pattern: D:\photos\trip\:EXIF_Date:\$0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that this EXIF data is contained in the meta tag of each photo, not in the file name. &lt;br /&gt;
#The meta tag &#039;&#039;&#039;:EXIF_Date:&#039;&#039;&#039; is replaced by the actual &#039;&#039;&#039;date taken&#039;&#039;&#039; for each photo. Thus all photos taken on the same date will be moved to the same folder. &lt;br /&gt;
#The actual name of the folder would depend on the [[ReNamer:Program settings#Meta_tags_settings|Date and Time format settings]].&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.extension &lt;br /&gt;
| title.text1.extension&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.text3.extension &lt;br /&gt;
| title.text1.text2.extension&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; The solution requires a stack of two different rules, as shown below: &lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Replace&#039;&#039;&#039; Rule &lt;br /&gt;
&lt;br /&gt;
Find: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Replace: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;[X] Last&amp;quot; to find and replace last occurrence of an dot only.&amp;lt;br /&amp;gt;&lt;br /&gt;
Check &amp;quot;[X] Skip Extension&amp;quot; to not replace the file/extension separator as last dot.&lt;br /&gt;
&lt;br /&gt;
(this is a temporary change; which will be eliminated in the second step) &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We had to do this indirectly because the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule cannot pick only the last dot as delimiter; and ignore the other dots. So we used a trick: we first changed the last dot into another character (using the &#039;&#039;&#039;Replace&#039;&#039;&#039; rule), and then use that new character as delimiter in the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts with more then one of the same delimiter &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First exchange the first occurrence of the delimiter by an completely other sign, e.g. #&amp;lt;BR&amp;gt;&lt;br /&gt;
* Add an &amp;quot;Replace&amp;quot; Rule&amp;lt;BR&amp;gt;&lt;br /&gt;
* Replace First &amp;quot; - &amp;quot;  with  &amp;quot;#&amp;quot;, [X] Skip Extension&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we got&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; # &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 ($1)&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since this rule removes the used delimiter, we don&#039;t have to take care about them in the output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text3.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-1&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the second last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text1.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-2&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; Since $-1 and $-2 count the tokens from the right (from the end), we will get the same result even if the name is longer. &lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Sort files with same names (but different extensions) into separate subfolder.&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Typically, training websites provide such sets of files for each episode/lecture/lesson, etc. (video, handout, homework, etc.)&amp;lt;br&amp;gt; &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; When you download these files, they are in a single folder. ReNamer helps you in sorting them into separate folders.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
We will see two different variations here:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-1:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is same as the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Episode 001.pdf&amp;lt;br&amp;gt;Episode 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Episode 002.pdf&amp;lt;br&amp;gt;Episode 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Episode 001\Episode 001.pdf&amp;lt;br&amp;gt;Episode 001\Episode 001.mp4 &lt;br /&gt;
&lt;br /&gt;
Episode 002\Episode 002.pdf&amp;lt;br&amp;gt;Episode 002\Episode 002.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using: - (Leave blank)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: $0\$0&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same base name will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-2:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is different as compared to the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Handout 001.pdf&amp;lt;br&amp;gt;Lesson 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Handout 002.pdf&amp;lt;br&amp;gt;Lesson 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Part 001\Handout.pdf&amp;lt;br&amp;gt;Part 001\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
Part 002\Handout.pdf&amp;lt;br&amp;gt; Part 002\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using:&amp;quot; &amp;quot; (space, without the quotes)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: Part $2\$1&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same &#039;&#039;number&#039;&#039; will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder&amp;lt;br&amp;gt;3. The &amp;quot;Part &amp;quot; is a literal string. (note the space at the end) &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Split by positions ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
FROM: &amp;lt;BR&amp;gt;&lt;br /&gt;
FECAAFC2309C055D7E7D61C4C669F9C0.dat &amp;lt;BR&amp;gt;&lt;br /&gt;
 0  1  2  3  4  5  6  7  8 9101112131415 &amp;lt;BR&amp;gt;&lt;br /&gt;
FE CA AF C2 30 9C 05 5D 7E7D61C4C669F9C0 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:  &amp;lt;BR&amp;gt;&lt;br /&gt;
C2AFCAFE9C305D057E7D61C4C669F9C0.dat &amp;lt;BR&amp;gt;&lt;br /&gt;
 3  2  1  0  5  4  7  6  8 9101112131415 &amp;lt;BR&amp;gt;&lt;br /&gt;
C2 AF CA FE 9C 30 5D 05 7E7D61C4C669F9C0 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
USE:  &lt;br /&gt;
Rearrange rule:  &amp;lt;BR&amp;gt;&lt;br /&gt;
If you enter position n, ReNamer will chop the n-th character and all characters beyond that in a separate piece.  &amp;lt;BR&amp;gt;&lt;br /&gt;
Split by positions: 3|5|7|9|11|13|15|17  &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $4$3$2$1$6$5$8$7$9  &amp;lt;BR&amp;gt;&lt;br /&gt;
Skip extension: YES  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB-AB-AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$1-$1 &amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB - CD (EFGHI)&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3|5 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 - $2 ($3) &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at pos. 3 till before pos. 5 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Store the rest (silently) in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
AB CD EFGHI &amp;lt;BR&amp;gt;&lt;br /&gt;
12 34 56789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABC - DEF - GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 4|7|10&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$2-$3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Store everything before position 4 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position (4) till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Everything starting at pos. 10 till the end in variable $3  (that ReNamer would do for us too) &amp;lt;BR&amp;gt;&lt;br /&gt;
ABC DEF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
123 456 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 5|7|555&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Store everything before position 5 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at pos. 5 till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
555 = Everything starting at the last position till the end in variable $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have dropped var &#039;$2&#039; in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1234 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
GHI (EF) A BC D&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 2|4|5|7|999&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $5 ($4) $1 $2 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
2 = Store everything before position 2 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Everything starting at the last position (2) till before pos. 4 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at the last position pos. till pos.5 in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position pos. till pos.7 in $4 &amp;lt;BR&amp;gt;&lt;br /&gt;
999 = Everything starting at the last position till the end in variable $5 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have rearranged (switched) the output vars in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
A BC D EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1 23 4 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3271</id>
		<title>ReNamer:Rules:Rearrange Examples</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3271"/>
		<updated>2018-08-30T08:03:26Z</updated>

		<summary type="html">&lt;p&gt;Stefan: /* Example 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|prev=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
[[ReNamer:Rules:Rearrange|Rearrange rule]] can be used in many ways. Few examples are given below. &lt;br /&gt;
&lt;br /&gt;
For simplicity&#039;s sake, we have split examples into two sections: [[#Basic usage|Basic usage]] (typical needs of beginners) and [[#Advanced usage|Advanced usage]] (for the power users).&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title.mp3&lt;br /&gt;
| Title - Artist.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; - &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 - $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
Explanation: We split the string at the hyphen (dash or minus sign -) or whatever you use to separate Artist from Title&amp;lt;BR&amp;gt;&lt;br /&gt;
Now, all signs before the dash are stored in variable $1, all after are put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
Because we want to swap this parts, we simple swap the vars in the output, the &amp;quot;New Pattern&amp;quot;: $2 $1&amp;lt;BR&amp;gt;&lt;br /&gt;
And since this rule removes the used delimiter, we add it on our own: &amp;quot;$2 - $1&amp;quot;, or use an new delimiter as e.g.: &amp;quot;$2_-_$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA - Ring Ring&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA -The winner takes it all&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA - $0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&amp;amp;nbsp; &#039;&#039;&#039;is same as the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]] &#039;&#039;&#039;rule.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before and after the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA- Ring Ring (Live)&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA-The winner takes it all (Live)&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA- $0 (Live) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; is same as using the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]]&#039;&#039;&#039; rule &amp;lt;u&amp;gt;twice&amp;lt;/u&amp;gt; (one for adding the prefix, and another for adding the suffix).&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Switch the words, and remove the comma between them. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| King, Stephen &lt;br /&gt;
| Stephen King&lt;br /&gt;
|-&lt;br /&gt;
| Cook, Robin &lt;br /&gt;
| Robin Cook&lt;br /&gt;
|-&lt;br /&gt;
| Pride and Prejudice, The &lt;br /&gt;
| The Pride and Prejudice&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;, &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move a word to a new position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Words sample 1234 07-07-07 &lt;br /&gt;
| 1234 Words sample 07-07-07&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; &amp;quot; (only a space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $3 $1 $2 $4 &lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Get rid of the numbers, hyphen and space at the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 01 - Afilename.zip &lt;br /&gt;
| Afilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 002 - Bfilename.zip &lt;br /&gt;
| Bfilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 0003 - Cfilename.zip &lt;br /&gt;
| Cfilename.zip&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiter contains a space. If only a hyphen is used as delimiter, then a space would be left out in the beginning of the name, which you would have to trim separately. &lt;br /&gt;
#The &#039;&#039;&#039;Delete&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the truncated names.&lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the first part to the end. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| TEST.aaa.bbb.100.ext &lt;br /&gt;
| aaa.bbb.100.TEST.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2.$3.$4.$1&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 8  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the artist&#039;s name from end to the beginning, and change the name format. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring ring_ABBA.mp3 &lt;br /&gt;
| ABBA - Ring Ring.mp3&lt;br /&gt;
|-&lt;br /&gt;
| Material girl_Madonna.mp3 &lt;br /&gt;
| Madonna - Material girl mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 9  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the numbers to the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-1.jpg &lt;br /&gt;
| 1-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-2.jpg &lt;br /&gt;
| 2-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-10.jpg &lt;br /&gt;
| 10-DSC_0001.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;-&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2-$1 &lt;br /&gt;
&lt;br /&gt;
=== Example 10  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert &amp;quot;sent_&amp;quot; before the last 3 digits. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| family_001.jpg &lt;br /&gt;
| family_sent_001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| work_023.jpg &lt;br /&gt;
| work_sent_023.jpg&lt;br /&gt;
|-&lt;br /&gt;
| friend_098.jpg &lt;br /&gt;
| friend_sent_098.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1_sent_$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Insert&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 11  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the name of the artist (delete text until hyphen). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Sting - All This Time.mp3 &lt;br /&gt;
| All This Time.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note the space after the hyphen. If we use just a &amp;quot;-&amp;quot; as delimiter, the second token would be left with a space in front, which we will have to trim separately. &lt;br /&gt;
#Even the &#039;&#039;&#039;Delete&#039;&#039;&#039; rule would have worked (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 12  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the track numbers (and any separator symbol after that) from the beginning of the filenames: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 08. Madonna - Like A Prayer.wma &lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08.-Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08 Madonna - Like A Prayer.wma&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;Madonna&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: Madonna$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks: &#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We chose the string &amp;quot;Madonna&amp;quot; as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes &amp;quot;Madonna&amp;quot; string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string &amp;quot;Madonna&amp;quot; to $2, to restore the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 13  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the number to front, and remove the square brackets. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Name XXX [0001].jpg &lt;br /&gt;
| 0001 - Name XXX.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [|]&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# The &amp;quot;|&amp;quot; (vertical pipe) character is used to separate the two delimiters. &lt;br /&gt;
# The second delimiter &amp;quot;]&amp;quot; will not produce a token. It is included only to remove it from the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 14  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Add composer name and duration to an mp3 file, as prefix and suffix, respectively. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Eine kleine Nachtmusik.mp3 &lt;br /&gt;
| Mozart - Eine kleine Nachtmusik (6.37).mp3&lt;br /&gt;
|-&lt;br /&gt;
| Don Giovanni.mp3 &lt;br /&gt;
| Mozart - Don Giovanni (4.5).mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Positions: 1 &lt;br /&gt;
&lt;br /&gt;
New Order: Mozart - $2 (:Audio_Duration:) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#This can also be done by using the &#039;&#039;&#039;Insert&#039;&#039;&#039; rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule allows you to add both in a single stroke. Besides, you can see the structure of the new name. &lt;br /&gt;
#When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The &#039;&#039;entire&#039;&#039; name is copied into the $2 token. This is a great trick to compose new name using the &#039;&#039;whole&#039;&#039; original name.&lt;br /&gt;
&lt;br /&gt;
=== Example 15  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name at fixed position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport1, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport2.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport2, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport3.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport3, Business.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2, $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since we didn&#039;t have an real delimiter here, we simply split at an position within the string, here e.g. at char number 9:&amp;lt;BR&amp;gt;&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&lt;br /&gt;
&lt;br /&gt;
So all before 9th char is put in variable $1, and all from char number 9 till end of string is put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
That means: $1 holds &#039;Business&#039; and $2 holds &#039;RawReport1&#039;. (Note that we skip the extension, so we don&#039;t have to deal with it)&amp;lt;BR&amp;gt;&lt;br /&gt;
Now we compose our new string, the output pattern, just as we like it to be: &#039;$2, $1&#039;&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
You can also use more then one delimiter or position:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| Raw Business Report1.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9|12&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789012&lt;br /&gt;
&lt;br /&gt;
$1 holds &#039;Business&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$2 holds &#039;Raw&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$3 holds &#039;Report1&#039;&lt;br /&gt;
&lt;br /&gt;
== Advanced usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the string from the file name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title [Time 4 02 Cold] [2004].mpg &lt;br /&gt;
| Artist - Title [2004].mpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [T|d] &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 $3 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#The &#039;&#039;&#039;|&#039;&#039;&#039; character separates the two delimiters. &lt;br /&gt;
#Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens. &lt;br /&gt;
#We have selected two &#039;&#039;different&#039;&#039; delimiters to represent the beginning and the end of the string we want to remove. Thus &#039;&#039;&#039;&#039;&#039;whatever&#039;&#039;&#039;&#039;&#039; lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; The file names contain artist name, album name and track name. Sort them into separate folders as follows: &lt;br /&gt;
&lt;br /&gt;
#Create a separate folder for each artist. &lt;br /&gt;
#For each artist, create a subfolder for each album. &lt;br /&gt;
#Move each file in the corresponding folder.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Title - Artist (Album).mp3 &lt;br /&gt;
| D:\Artist\Album\Title.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; - | (|)&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: D:\$2\$3\$1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiters contain spaces and symbols, so that only text remains in the tokens. &lt;br /&gt;
#The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token. &lt;br /&gt;
#Instead of &#039;&#039;&#039;D:&#039;&#039;&#039; a relative path (such as &#039;&#039;&#039;..\..\&#039;&#039;&#039;) can be added to the front.&lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Sort digital photos in different folders based on the &#039;&#039;&#039;Date taken&#039;&#039;&#039; for each photo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Many people call this operation &amp;quot;binning&amp;quot;, because we segregate the items into separate bins based on some criteria. (most people associate the word &amp;quot;Sorting&amp;quot; with &amp;quot;rearranging the files in ascending/descending order, without moving them to other folders&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0002.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0002.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0003.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_25\DSC_0003.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: - (none)&lt;br /&gt;
&lt;br /&gt;
New pattern: D:\photos\trip\:EXIF_Date:\$0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that this EXIF data is contained in the meta tag of each photo, not in the file name. &lt;br /&gt;
#The meta tag &#039;&#039;&#039;:EXIF_Date:&#039;&#039;&#039; is replaced by the actual &#039;&#039;&#039;date taken&#039;&#039;&#039; for each photo. Thus all photos taken on the same date will be moved to the same folder. &lt;br /&gt;
#The actual name of the folder would depend on the [[ReNamer:Program settings#Meta_tags_settings|Date and Time format settings]].&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.extension &lt;br /&gt;
| title.text1.extension&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.text3.extension &lt;br /&gt;
| title.text1.text2.extension&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; The solution requires a stack of two different rules, as shown below: &lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Replace&#039;&#039;&#039; Rule &lt;br /&gt;
&lt;br /&gt;
Find: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Replace: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;[X] Last&amp;quot; to find and replace last occurrence of an dot only.&amp;lt;br /&amp;gt;&lt;br /&gt;
Check &amp;quot;[X] Skip Extension&amp;quot; to not replace the file/extension separator as last dot.&lt;br /&gt;
&lt;br /&gt;
(this is a temporary change; which will be eliminated in the second step) &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We had to do this indirectly because the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule cannot pick only the last dot as delimiter; and ignore the other dots. So we used a trick: we first changed the last dot into another character (using the &#039;&#039;&#039;Replace&#039;&#039;&#039; rule), and then use that new character as delimiter in the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts with more then one of the same delimiter &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First exchange the first occurrence of the delimiter by an completely other sign, e.g. #&amp;lt;BR&amp;gt;&lt;br /&gt;
* Add an &amp;quot;Replace&amp;quot; Rule&amp;lt;BR&amp;gt;&lt;br /&gt;
* Replace First &amp;quot; - &amp;quot;  with  &amp;quot;#&amp;quot;, [X] Skip Extension&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we got&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; # &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 ($1)&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since this rule removes the used delimiter, we don&#039;t have to take care about them in the output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text3.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-1&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the second last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text1.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-2&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; Since $-1 and $-2 count the tokens from the right (from the end), we will get the same result even if the name is longer. &lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Sort files with same names (but different extensions) into separate subfolder.&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Typically, training websites provide such sets of files for each episode/lecture/lesson, etc. (video, handout, homework, etc.)&amp;lt;br&amp;gt; &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; When you download these files, they are in a single folder. ReNamer helps you in sorting them into separate folders.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
We will see two different variations here:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-1:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is same as the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Episode 001.pdf&amp;lt;br&amp;gt;Episode 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Episode 002.pdf&amp;lt;br&amp;gt;Episode 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Episode 001\Episode 001.pdf&amp;lt;br&amp;gt;Episode 001\Episode 001.mp4 &lt;br /&gt;
&lt;br /&gt;
Episode 002\Episode 002.pdf&amp;lt;br&amp;gt;Episode 002\Episode 002.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using: - (Leave blank)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: $0\$0&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same base name will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-2:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is different as compared to the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Handout 001.pdf&amp;lt;br&amp;gt;Lesson 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Handout 002.pdf&amp;lt;br&amp;gt;Lesson 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Part 001\Handout.pdf&amp;lt;br&amp;gt;Part 001\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
Part 002\Handout.pdf&amp;lt;br&amp;gt; Part 002\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using:&amp;quot; &amp;quot; (space, without the quotes)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: Part $2\$1&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same &#039;&#039;number&#039;&#039; will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder&amp;lt;br&amp;gt;3. The &amp;quot;Part &amp;quot; is a literal string. (note the space at the end) &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Split by positions ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
FROM: &lt;br /&gt;
FECAAFC2309C055D7E7D61C4C669F9C0.dat &lt;br /&gt;
 0  1  2  3  4  5  6  7  8 9101112131415 &lt;br /&gt;
FE CA AF C2 30 9C 05 5D 7E7D61C4C669F9C0 &lt;br /&gt;
&lt;br /&gt;
TO:  &lt;br /&gt;
C2AFCAFE9C305D057E7D61C4C669F9C0.dat &lt;br /&gt;
 3  2  1  0  5  4  7  6  8 9101112131415 &lt;br /&gt;
C2 AF CA FE 9C 30 5D 05 7E7D61C4C669F9C0 &lt;br /&gt;
&lt;br /&gt;
USE:  &lt;br /&gt;
Rearrange rule:  &amp;lt;BR&amp;gt;&lt;br /&gt;
If you enter position n, ReNamer will chop the n-th character and all characters beyond that in a separate piece.  &amp;lt;BR&amp;gt;&lt;br /&gt;
Split by positions: 3|5|7|9|11|13|15|17  &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $4$3$2$1$6$5$8$7$9  &amp;lt;BR&amp;gt;&lt;br /&gt;
Skip extension: YES  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB-AB-AB&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$1-$1 &amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
AB - CD (EFGHI)&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 3|5 &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 - $2 ($3) &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&amp;lt;BR&amp;gt;&lt;br /&gt;
3 = Store everything before position 3 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at pos. 3 till before pos. 5 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Store the rest (silently) in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
AB CD EFGHI &amp;lt;BR&amp;gt;&lt;br /&gt;
12 34 56789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABC - DEF - GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 4|7|10&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1-$2-$3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Store everything before position 4 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position (4) till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
Everything starting at pos. 10 till the end in variable $3  (that ReNamer would do for us too) &amp;lt;BR&amp;gt;&lt;br /&gt;
ABC DEF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
123 456 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD GHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 5|7|555&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Store everything before position 5 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at pos. 5 till before pos. 7 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
555 = Everything starting at the last position till the end in variable $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have dropped var &#039;$2&#039; in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
ABCD EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1234 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
- - -&lt;br /&gt;
&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
ABCDEFGHI&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
GHI (EF) A BC D&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Split by positions: 2|4|5|7|999&amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $5 ($4) $1 $2 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: &amp;lt;BR&amp;gt;&lt;br /&gt;
2 = Store everything before position 2 in variable $1 &amp;lt;BR&amp;gt;&lt;br /&gt;
4 = Everything starting at the last position (2) till before pos. 4 in variable $2 &amp;lt;BR&amp;gt;&lt;br /&gt;
5 = Everything starting at the last position pos. till pos.5 in $3 &amp;lt;BR&amp;gt;&lt;br /&gt;
7 = Everything starting at the last position pos. till pos.7 in $4 &amp;lt;BR&amp;gt;&lt;br /&gt;
999 = Everything starting at the last position till the end in variable $5 &amp;lt;BR&amp;gt;&lt;br /&gt;
Please note that we have rearranged (switched) the output vars in the &#039;New pattern&#039;. &amp;lt;BR&amp;gt;&lt;br /&gt;
A BC D EF GHI &amp;lt;BR&amp;gt;&lt;br /&gt;
1 23 4 56 789 &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3270</id>
		<title>ReNamer:Rules:Rearrange Examples</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:Rearrange_Examples&amp;diff=3270"/>
		<updated>2018-08-30T07:56:03Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|prev=ReNamer:Rules:Rearrange}}&lt;br /&gt;
&lt;br /&gt;
[[ReNamer:Rules:Rearrange|Rearrange rule]] can be used in many ways. Few examples are given below. &lt;br /&gt;
&lt;br /&gt;
For simplicity&#039;s sake, we have split examples into two sections: [[#Basic usage|Basic usage]] (typical needs of beginners) and [[#Advanced usage|Advanced usage]] (for the power users).&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title.mp3&lt;br /&gt;
| Title - Artist.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; - &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 - $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
Explanation: We split the string at the hyphen (dash or minus sign -) or whatever you use to separate Artist from Title&amp;lt;BR&amp;gt;&lt;br /&gt;
Now, all signs before the dash are stored in variable $1, all after are put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
Because we want to swap this parts, we simple swap the vars in the output, the &amp;quot;New Pattern&amp;quot;: $2 $1&amp;lt;BR&amp;gt;&lt;br /&gt;
And since this rule removes the used delimiter, we add it on our own: &amp;quot;$2 - $1&amp;quot;, or use an new delimiter as e.g.: &amp;quot;$2_-_$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA - Ring Ring&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA -The winner takes it all&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA - $0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&amp;amp;nbsp; &#039;&#039;&#039;is same as the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]] &#039;&#039;&#039;rule.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert text before and after the original name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring Ring&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA- Ring Ring (Live)&lt;br /&gt;
|-&lt;br /&gt;
| The winner takes it all&amp;lt;br&amp;gt; &lt;br /&gt;
| ABBA-The winner takes it all (Live)&amp;lt;br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: none (leave blank)&lt;br /&gt;
&lt;br /&gt;
New order/pattern: ABBA- $0 (Live) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; is same as using the &#039;&#039;&#039;[[ReNamer:Rules:Insert|Insert]]&#039;&#039;&#039; rule &amp;lt;u&amp;gt;twice&amp;lt;/u&amp;gt; (one for adding the prefix, and another for adding the suffix).&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Switch the words, and remove the comma between them. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| King, Stephen &lt;br /&gt;
| Stephen King&lt;br /&gt;
|-&lt;br /&gt;
| Cook, Robin &lt;br /&gt;
| Robin Cook&lt;br /&gt;
|-&lt;br /&gt;
| Pride and Prejudice, The &lt;br /&gt;
| The Pride and Prejudice&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;, &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move a word to a new position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Words sample 1234 07-07-07 &lt;br /&gt;
| 1234 Words sample 07-07-07&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; &amp;quot; (only a space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $3 $1 $2 $4 &lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Get rid of the numbers, hyphen and space at the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 01 - Afilename.zip &lt;br /&gt;
| Afilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 002 - Bfilename.zip &lt;br /&gt;
| Bfilename.zip&lt;br /&gt;
|-&lt;br /&gt;
| 0003 - Cfilename.zip &lt;br /&gt;
| Cfilename.zip&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiter contains a space. If only a hyphen is used as delimiter, then a space would be left out in the beginning of the name, which you would have to trim separately. &lt;br /&gt;
#The &#039;&#039;&#039;Delete&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the truncated names.&lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the first part to the end. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| TEST.aaa.bbb.100.ext &lt;br /&gt;
| aaa.bbb.100.TEST.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2.$3.$4.$1&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Example 8  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Move the artist&#039;s name from end to the beginning, and change the name format. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Ring ring_ABBA.mp3 &lt;br /&gt;
| ABBA - Ring Ring.mp3&lt;br /&gt;
|-&lt;br /&gt;
| Material girl_Madonna.mp3 &lt;br /&gt;
| Madonna - Material girl mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
=== Example 9  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the numbers to the beginning. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-1.jpg &lt;br /&gt;
| 1-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-2.jpg &lt;br /&gt;
| 2-DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001-10.jpg &lt;br /&gt;
| 10-DSC_0001.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;-&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2-$1 &lt;br /&gt;
&lt;br /&gt;
=== Example 10  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Insert &amp;quot;sent_&amp;quot; before the last 3 digits. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| family_001.jpg &lt;br /&gt;
| family_sent_001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| work_023.jpg &lt;br /&gt;
| work_sent_023.jpg&lt;br /&gt;
|-&lt;br /&gt;
| friend_098.jpg &lt;br /&gt;
| friend_sent_098.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;_&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1_sent_$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Insert&#039;&#039;&#039; rule also would work (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 11  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the name of the artist (delete text until hyphen). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Sting - All This Time.mp3 &lt;br /&gt;
| All This Time.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;- &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note the space after the hyphen. If we use just a &amp;quot;-&amp;quot; as delimiter, the second token would be left with a space in front, which we will have to trim separately. &lt;br /&gt;
#Even the &#039;&#039;&#039;Delete&#039;&#039;&#039; rule would have worked (in &#039;&#039;right-to-left &#039;&#039;mode). But the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule also allows you to add any string to the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 12  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the track numbers (and any separator symbol after that) from the beginning of the filenames: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| 08. Madonna - Like A Prayer.wma &lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; | Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08.-Madonna - Like A Prayer.wma&lt;br /&gt;
|-&lt;br /&gt;
| 08 Madonna - Like A Prayer.wma&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;Madonna&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: Madonna$2 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks: &#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We chose the string &amp;quot;Madonna&amp;quot; as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes &amp;quot;Madonna&amp;quot; string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string &amp;quot;Madonna&amp;quot; to $2, to restore the names. &lt;br /&gt;
&lt;br /&gt;
=== Example 13  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Move the number to front, and remove the square brackets. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Name XXX [0001].jpg &lt;br /&gt;
| 0001 - Name XXX.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [|]&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $2 - $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
# The &amp;quot;|&amp;quot; (vertical pipe) character is used to separate the two delimiters. &lt;br /&gt;
# The second delimiter &amp;quot;]&amp;quot; will not produce a token. It is included only to remove it from the new name.&lt;br /&gt;
&lt;br /&gt;
=== Example 14  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Add composer name and duration to an mp3 file, as prefix and suffix, respectively. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Eine kleine Nachtmusik.mp3 &lt;br /&gt;
| Mozart - Eine kleine Nachtmusik (6.37).mp3&lt;br /&gt;
|-&lt;br /&gt;
| Don Giovanni.mp3 &lt;br /&gt;
| Mozart - Don Giovanni (4.5).mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Positions: 1 &lt;br /&gt;
&lt;br /&gt;
New Order: Mozart - $2 (:Audio_Duration:) &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#This can also be done by using the &#039;&#039;&#039;Insert&#039;&#039;&#039; rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule allows you to add both in a single stroke. Besides, you can see the structure of the new name. &lt;br /&gt;
#When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The &#039;&#039;entire&#039;&#039; name is copied into the $2 token. This is a great trick to compose new name using the &#039;&#039;whole&#039;&#039; original name.&lt;br /&gt;
&lt;br /&gt;
=== Example 15  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts of name at fixed position. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport1, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport2.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport2, Business.doc&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport3.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| RawReport3, Business.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2, $1&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since we didn&#039;t have an real delimiter here, we simply split at an position within the string, here e.g. at char number 9:&amp;lt;BR&amp;gt;&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&lt;br /&gt;
&lt;br /&gt;
So all before 9th char is put in variable $1, and all from char number 9 till end of string is put in var $2.&amp;lt;BR&amp;gt;&lt;br /&gt;
That means: $1 holds &#039;Business&#039; and $2 holds &#039;RawReport1&#039;. (Note that we skip the extension, so we don&#039;t have to deal with it)&amp;lt;BR&amp;gt;&lt;br /&gt;
Now we compose our new string, the output pattern, just as we like it to be: &#039;$2, $1&#039;&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
You can also use more then one delimiter or position:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
| Raw Business Report1.doc&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Positions &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;9|12&amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 $1 $3&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
BusinessRawReport1.doc&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789&amp;lt;BR&amp;gt;&lt;br /&gt;
123456789012&lt;br /&gt;
&lt;br /&gt;
$1 holds &#039;Business&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$2 holds &#039;Raw&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
$3 holds &#039;Report1&#039;&lt;br /&gt;
&lt;br /&gt;
== Advanced usage ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Remove the string from the file name. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Artist - Title [Time 4 02 Cold] [2004].mpg &lt;br /&gt;
| Artist - Title [2004].mpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; [T|d] &amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 $3 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#The &#039;&#039;&#039;|&#039;&#039;&#039; character separates the two delimiters. &lt;br /&gt;
#Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens. &lt;br /&gt;
#We have selected two &#039;&#039;different&#039;&#039; delimiters to represent the beginning and the end of the string we want to remove. Thus &#039;&#039;&#039;&#039;&#039;whatever&#039;&#039;&#039;&#039;&#039; lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; The file names contain artist name, album name and track name. Sort them into separate folders as follows: &lt;br /&gt;
&lt;br /&gt;
#Create a separate folder for each artist. &lt;br /&gt;
#For each artist, create a subfolder for each album. &lt;br /&gt;
#Move each file in the corresponding folder.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| Title - Artist (Album).mp3 &lt;br /&gt;
| D:\Artist\Album\Title.mp3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot; - | (|)&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: D:\$2\$3\$1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that the delimiters contain spaces and symbols, so that only text remains in the tokens. &lt;br /&gt;
#The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token. &lt;br /&gt;
#Instead of &#039;&#039;&#039;D:&#039;&#039;&#039; a relative path (such as &#039;&#039;&#039;..\..\&#039;&#039;&#039;) can be added to the front.&lt;br /&gt;
&lt;br /&gt;
=== Example 3  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task: &#039;&#039;&#039;Sort digital photos in different folders based on the &#039;&#039;&#039;Date taken&#039;&#039;&#039; for each photo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Many people call this operation &amp;quot;binning&amp;quot;, because we segregate the items into separate bins based on some criteria. (most people associate the word &amp;quot;Sorting&amp;quot; with &amp;quot;rearranging the files in ascending/descending order, without moving them to other folders&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0001.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0001.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0002.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_21\DSC_0002.jpg&lt;br /&gt;
|-&lt;br /&gt;
| DSC_0003.jpg &lt;br /&gt;
| D:\photos\trip\2009_10_25\DSC_0003.jpg&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Delimiter: - (none)&lt;br /&gt;
&lt;br /&gt;
New pattern: D:\photos\trip\:EXIF_Date:\$0 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
#Note that this EXIF data is contained in the meta tag of each photo, not in the file name. &lt;br /&gt;
#The meta tag &#039;&#039;&#039;:EXIF_Date:&#039;&#039;&#039; is replaced by the actual &#039;&#039;&#039;date taken&#039;&#039;&#039; for each photo. Thus all photos taken on the same date will be moved to the same folder. &lt;br /&gt;
#The actual name of the folder would depend on the [[ReNamer:Program settings#Meta_tags_settings|Date and Time format settings]].&lt;br /&gt;
&lt;br /&gt;
=== Example 4  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots). &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.extension &lt;br /&gt;
| title.text1.extension&lt;br /&gt;
|-&lt;br /&gt;
| title.text1.text2.text3.extension &lt;br /&gt;
| title.text1.text2.extension&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setting:&#039;&#039;&#039; The solution requires a stack of two different rules, as shown below: &lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Replace&#039;&#039;&#039; Rule &lt;br /&gt;
&lt;br /&gt;
Find: &amp;quot;.&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Replace: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;[X] Last&amp;quot; to find and replace last occurrence of an dot only.&amp;lt;br /&amp;gt;&lt;br /&gt;
Check &amp;quot;[X] Skip Extension&amp;quot; to not replace the file/extension separator as last dot.&lt;br /&gt;
&lt;br /&gt;
(this is a temporary change; which will be eliminated in the second step) &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule &lt;br /&gt;
&lt;br /&gt;
Delimiter: &amp;quot;#&amp;quot; (without the quotes) &lt;br /&gt;
&lt;br /&gt;
New Order: $1 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
We had to do this indirectly because the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule cannot pick only the last dot as delimiter; and ignore the other dots. So we used a trick: we first changed the last dot into another character (using the &#039;&#039;&#039;Replace&#039;&#039;&#039; rule), and then use that new character as delimiter in the &#039;&#039;&#039;Rearrange&#039;&#039;&#039; rule.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 5  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Swap parts with more then one of the same delimiter &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author - Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
First exchange the first occurrence of the delimiter by an completely other sign, e.g. #&amp;lt;BR&amp;gt;&lt;br /&gt;
* Add an &amp;quot;Replace&amp;quot; Rule&amp;lt;BR&amp;gt;&lt;br /&gt;
* Replace First &amp;quot; - &amp;quot;  with  &amp;quot;#&amp;quot;, [X] Skip Extension&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So we got&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title - True story.pdf&lt;br /&gt;
| Book title - True story (I. Author).pdf&lt;br /&gt;
|-&lt;br /&gt;
| I. Author # Book title.pdf&lt;br /&gt;
| Book title (I. Author).pdf&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now use&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot; # &amp;quot; (without the quotes)&amp;lt;BR&amp;gt; &lt;br /&gt;
&lt;br /&gt;
New pattern: $2 ($1)&amp;lt;BR&amp;gt;&lt;br /&gt;
[X] Skip Extensions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; &lt;br /&gt;
Since this rule removes the used delimiter, we don&#039;t have to take care about them in the output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example 6  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text3.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-1&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Keep only the second last part of a file name: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2.txt &lt;br /&gt;
| text1.txt&lt;br /&gt;
|-&lt;br /&gt;
| title text1 text2 text3.txt &lt;br /&gt;
| text2.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Split using: (o)Delimiter &amp;lt;br&amp;gt; &amp;quot; &amp;quot; (space, without the quotes) &lt;br /&gt;
&lt;br /&gt;
New pattern: $-2&amp;lt;br&amp;gt; [X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks:&#039;&#039;&#039; Since $-1 and $-2 count the tokens from the right (from the end), we will get the same result even if the name is longer. &lt;br /&gt;
&lt;br /&gt;
=== Example 7  ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task:&#039;&#039;&#039; Sort files with same names (but different extensions) into separate subfolder.&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Typically, training websites provide such sets of files for each episode/lecture/lesson, etc. (video, handout, homework, etc.)&amp;lt;br&amp;gt; &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; When you download these files, they are in a single folder. ReNamer helps you in sorting them into separate folders.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
We will see two different variations here:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-1:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is same as the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Episode 001.pdf&amp;lt;br&amp;gt;Episode 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Episode 002.pdf&amp;lt;br&amp;gt;Episode 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Episode 001\Episode 001.pdf&amp;lt;br&amp;gt;Episode 001\Episode 001.mp4 &lt;br /&gt;
&lt;br /&gt;
Episode 002\Episode 002.pdf&amp;lt;br&amp;gt;Episode 002\Episode 002.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using: - (Leave blank)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: $0\$0&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same base name will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Variation-2:&#039;&#039;&#039; &#039;&#039;&#039;The subfolder name is different as compared to the base name of the files.&#039;&#039;&#039;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! From: &lt;br /&gt;
! To:&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
Handout 001.pdf&amp;lt;br&amp;gt;Lesson 001.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Handout 002.pdf&amp;lt;br&amp;gt;Lesson 002.mp4&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
Part 001\Handout.pdf&amp;lt;br&amp;gt;Part 001\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
Part 002\Handout.pdf&amp;lt;br&amp;gt; Part 002\Lesson.mp4 &lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;Split using:&amp;quot; &amp;quot; (space, without the quotes)&amp;lt;br&amp;gt;&amp;amp;nbsp;New pattern: Part $2\$1&amp;lt;br&amp;gt;&amp;amp;nbsp;[X] Skip Extensions &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remarks&#039;&#039;&#039;: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
1. All files having the same &#039;&#039;number&#039;&#039; will be sorted into a common subfolder. &amp;lt;br&amp;gt;2. ReNamer will create these subfolders in the current folder&amp;lt;br&amp;gt;3. The &amp;quot;Part &amp;quot; is a literal string. (note the space at the end) &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Split by positions ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1  ===&lt;br /&gt;
&lt;br /&gt;
FROM: &lt;br /&gt;
FECAAFC2309C055D7E7D61C4C669F9C0.dat &lt;br /&gt;
 0  1  2  3  4  5  6  7  8 9101112131415 &lt;br /&gt;
FE CA AF C2 30 9C 05 5D 7E7D61C4C669F9C0 &lt;br /&gt;
&lt;br /&gt;
TO:  &lt;br /&gt;
C2AFCAFE9C305D057E7D61C4C669F9C0.dat &lt;br /&gt;
 3  2  1  0  5  4  7  6  8 9101112131415 &lt;br /&gt;
C2 AF CA FE 9C 30 5D 05 7E7D61C4C669F9C0 &lt;br /&gt;
&lt;br /&gt;
USE:  &lt;br /&gt;
Rearrange rule:  &amp;lt;BR&amp;gt;&lt;br /&gt;
If you enter position n, ReNamer will chop the n-th character and all characters beyond that in a separate piece.  &amp;lt;BR&amp;gt;&lt;br /&gt;
Split by positions: 3|5|7|9|11|13|15|17  &amp;lt;BR&amp;gt;&lt;br /&gt;
New pattern: $4$3$2$1$6$5$8$7$9  &amp;lt;BR&amp;gt;&lt;br /&gt;
Skip extension: YES  &amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example 2  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2781</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2781"/>
		<updated>2014-08-10T18:24:00Z</updated>

		<summary type="html">&lt;p&gt;Stefan: cleaned up the modifications&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup|This page is work in process! I want to clean up this page later. If you want to help please do so. -- [[User:Stefan|Stefan]]}}&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them. Also you may want to store an index number, or perhaps a list of the original file names. There are several techniques to store variable values, feel free to choose the one that suits you.&lt;br /&gt;
&lt;br /&gt;
== File Approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== Utilized Function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vars,v:string;&lt;br /&gt;
  Lines,CurrLine:TStringsArray;&lt;br /&gt;
  i:integer;&lt;br /&gt;
   &lt;br /&gt;
begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registry Approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
&lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v TestName1&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    // Result:&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      TestName1       REG_SZ  Test value 1&lt;br /&gt;
    //  &lt;br /&gt;
      &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value &amp;quot;Test value 1&amp;quot;---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clipboard Approach ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vLastExtension, vCurrentExtension: WideString;&lt;br /&gt;
begin&lt;br /&gt;
  // At start, load stored data //Load/Read/Get:&lt;br /&gt;
  vLastExtension := GetClipboardText;&lt;br /&gt;
  // Add here some error handling and cleanup code for vLastExtension &lt;br /&gt;
  //if Length(vLastExtension) &amp;gt; 4 then Exit;&lt;br /&gt;
  //&lt;br /&gt;
  // Add your code here and use content of var vLastExtension&lt;br /&gt;
  vCurrentExtension := WideExtractFileExt(FileName);&lt;br /&gt;
  if vCurrentExtension &amp;lt;&amp;gt; vLastExtension then&lt;br /&gt;
   .....&lt;br /&gt;
  // &lt;br /&gt;
  // &lt;br /&gt;
  // &lt;br /&gt;
  // At the end store the wanted data //Store/Write/Set:&lt;br /&gt;
  SetClipboardText(vCurrentExtension);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2780</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2780"/>
		<updated>2014-08-10T18:14:03Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &amp;quot;Clipboard Approach&amp;quot; examples updated to smtg more meaningful&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup|This page is work in process! I want to clean up this page later. If you want to help please do so. -- [[User:Stefan|Stefan]]}}&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them. Also you may want to store an index number, or perhaps a list of the original file names. There are several techniques to store variable values, feel free to choose the one that suits you.&lt;br /&gt;
&lt;br /&gt;
== File Approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== Utilized Function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vars,v:string;&lt;br /&gt;
  Lines,CurrLine:TStringsArray;&lt;br /&gt;
  i:integer;&lt;br /&gt;
   &lt;br /&gt;
begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registry Approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
&lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v TestName1&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    // Result:&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      TestName1       REG_SZ  Test value 1&lt;br /&gt;
    //  &lt;br /&gt;
      &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value &amp;quot;Test value 1&amp;quot;---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clipboard Approach ==&lt;br /&gt;
&lt;br /&gt;
//Store/Write/Set:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vCurrentExtension: WideString;&lt;br /&gt;
begin&lt;br /&gt;
  // Add your code here:&lt;br /&gt;
  vCurrentExtension:= WideExtractFileExt(FileName);&lt;br /&gt;
  // &lt;br /&gt;
  // &lt;br /&gt;
  // &lt;br /&gt;
  // At the end store the wanted data:&lt;br /&gt;
  SetClipboardText(vCurrentExtension);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//Load/Read/Get: &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vLastExtension, vCurrentExtension: WideString;&lt;br /&gt;
begin&lt;br /&gt;
  // At start load stored data:&lt;br /&gt;
  vLastExtension := GetClipboardText;&lt;br /&gt;
  // Add your code here and use content of var vLastExtension&lt;br /&gt;
  // &lt;br /&gt;
     vCurrentExtension := WideExtractFileExt(FileName);&lt;br /&gt;
  if vCurrentExtension &amp;lt;&amp;gt; vLastExtension then&lt;br /&gt;
   .....&lt;br /&gt;
  // &lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2590</id>
		<title>ReNamer:Using presets</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2590"/>
		<updated>2014-01-15T07:02:04Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;preset&amp;quot; is a set of rules that is saved with a user-defined name. It can optionally save the [[ReNamer:Menus for the Files pane#Filters_menu|Filter setting]] also. &lt;br /&gt;
&lt;br /&gt;
You can save frequently used sets of rules as presets, and load them instantly. This saves you a lot of time. Without the presets, you would have to compose the same set of rules each time you start the program. You can create an unlimited number of presets, but in practice, you would normally need about 4-5 presets.&lt;br /&gt;
&lt;br /&gt;
== Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
ReNamer automatically assigns keyboard shortcuts to presets, so that they can be loaded into the &#039;&#039;&#039;Rules&#039;&#039;&#039; pane with least effort. Shortcuts have the following form: &#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, &#039;&#039;&#039;CTRL+2&#039;&#039;&#039;, etc. Unfortunately, there are only 9 shortcuts available, one for every digit from 1 to 9.&lt;br /&gt;
&lt;br /&gt;
Presets are sorted in alphabetic order. You can manipulate the order of the presets by renaming them. If you want some specific preset to always appear at the top, you can insert an exclamation mark &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot; (or some other symbol that is at the top of the sorting order) in front of the preset name. If you have several presets that you want to push to the top, you can prefix them with something like this: &amp;quot;&#039;&#039;&#039;!1&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!2&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!3&#039;&#039;&#039;&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
== Managing Presets ==&lt;br /&gt;
&lt;br /&gt;
=== Save a preset ===&lt;br /&gt;
&lt;br /&gt;
# Create a list of rules ([[ReNamer:Managing rules|Managing rules]]).&lt;br /&gt;
# Set the required [[ReNamer:Menus for the Files pane#Filters_menu|Filter settings]] (optional).&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+S&#039;&#039;&#039;, or use the &#039;&#039;&#039;Presets &amp;amp;gt; Save As&#039;&#039;&#039; menu option.&lt;br /&gt;
# A window pops up:&amp;lt;br&amp;gt;[[Image:SavePresetDialog.png|center]]&lt;br /&gt;
# Enter a new name in the &#039;&#039;&#039;Name&#039;&#039;&#039; box, or select one of the existing presets listed below to overwrite it.&lt;br /&gt;
# Put a tick in the check box if you want to save the current filter settings.&lt;br /&gt;
# Press the &#039;&#039;&#039;Save&#039;&#039;&#039; button. The preset is saved. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; At any point of time, you can abort the process by pressing &#039;&#039;&#039;ESC&#039;&#039;&#039; or closing the window.&lt;br /&gt;
&lt;br /&gt;
=== Load an existing preset ===&lt;br /&gt;
&lt;br /&gt;
You can load any of the presets by pressing its shortcut (&#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, etc. see above). If you do not remember the shortcuts, use the&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&#039;&#039;&#039;Preset &amp;amp;gt; Load&#039;&#039;&#039; menu to see the master list of all existing presets and select a preset from that list.The selected preset is loaded.&lt;br /&gt;
&lt;br /&gt;
=== Append an existing preset to current set of rules ===&lt;br /&gt;
&lt;br /&gt;
You can append any of the presets to the end of the current rules stack. To do it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to append and then press the [[Image:Append_preset_button.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Delete an existing preset ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you may not need a preset any longer. To delete it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to delete and then press &#039;&#039;&#039;DEL&#039;&#039;&#039; key or the [[Image:PresetDeleteButton.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Rename a preset ===&lt;br /&gt;
&lt;br /&gt;
To rename a preset, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The Preset manager window pops up.&lt;br /&gt;
# Select the preset you want to rename and then press &#039;&#039;&#039;F2&#039;&#039;&#039; or the [[Image:RenamePresetButton.png]] button.&lt;br /&gt;
# The following dialog pops up:&amp;lt;br&amp;gt;[[Image:RenamePresetDialog.png|center]]&lt;br /&gt;
# Edit the name (or enter a new name), and press &#039;&#039;&#039;OK&#039;&#039;&#039; or &#039;&#039;&#039;ENTER&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To abort the process at any time, press &#039;&#039;&#039;ESC&#039;&#039;&#039; or close the window.&lt;br /&gt;
&lt;br /&gt;
=== Edit a preset ===&lt;br /&gt;
&lt;br /&gt;
The preset manager can show the contents of a preset (i.e., settings of all rules and filters) as editable text. You can simply edit the rules and filters by changing the text.&lt;br /&gt;
&lt;br /&gt;
To edit a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to edit and then press &#039;&#039;&#039;F4&#039;&#039;&#039; or the [[Image:EditPresetButton.png]] button.&lt;br /&gt;
# A warning pops up:&amp;lt;br&amp;gt;[[Image:EditPresetWarning.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. A Notepad (text editor) window pops up with the selected preset:&amp;lt;br&amp;gt;[[Image:PresetEditWindow.png|center]]&lt;br /&gt;
#: Notice that:&lt;br /&gt;
#:* This window shows the preset name in the title bar, and all settings (rules and filters). &lt;br /&gt;
#:* In each rule, the parameters are shown in &#039;&#039;&#039;ParameterName:ParameterValue &#039;&#039;&#039;format. &lt;br /&gt;
#:* All such pairs are separated by a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;).&lt;br /&gt;
# Edit the settings and then close the file. A confirmation dialog pops up.&amp;lt;br&amp;gt;[[Image:SaveChangedmpFileDialog.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. Now the preset is edited. &lt;br /&gt;
&lt;br /&gt;
=== Copy a preset ===&lt;br /&gt;
&lt;br /&gt;
You may want to duplicate an existing preset and create a variation by editing it (or just take a backup of the preset before experimenting with it). &lt;br /&gt;
&lt;br /&gt;
To duplicate a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to duplicate and then press the [[Image:CopyPresetButton.png]] button.&lt;br /&gt;
# A duplicate copy of the preset is created.&lt;br /&gt;
# Now go ahead and edit the original present (or its copy).&lt;br /&gt;
# Finally close the &#039;&#039;&#039;Presets Manager&#039;&#039;&#039; window. &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
== Backup / Transfer Presets ==&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Presets are stored as plain text files, stored by default in a folder called Presets.&amp;lt;BR&amp;gt;&lt;br /&gt;
On default, this Presets folder is in the same folder as the ReNamer.exe,&amp;lt;BR&amp;gt;&lt;br /&gt;
but it could be stored in your Windows user profile too.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can simple tell by launching ReNamer and open the Presets Manager: &amp;quot;Presets &amp;gt; Manage...&amp;quot; (Ctrl+P)&amp;lt;BR&amp;gt;&lt;br /&gt;
On the top you will see the path to the presets folder (see pictures above).&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
There is also a menu item &amp;quot;Presets &amp;gt; Browse...&amp;quot; which will open WinExplorer with that folder in view.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
But please note; with older versions of ReNamer on Vista/Win7 that may not bring you to the right path, &amp;lt;BR&amp;gt;&lt;br /&gt;
since Windows with enabled UAC (search the forum) will lie to us and redirect paths.&amp;lt;BR&amp;gt;&lt;br /&gt;
In such case just take a quick look into this redirection folders of Windows:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\Users\&amp;lt;yourName&amp;gt;\AppData\Local\VirtualStore\Program Files (x86)\ReNamer\Presets\*.rnp&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\Users\&amp;lt;yourName&amp;gt;\AppData\Local\VirtualStore\Program Files\ReNamer\Presets\*.rnp&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
or for Germans: &amp;quot;C:\Benutzer\&amp;lt;DeinName&amp;gt;\AppData\...&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To backup or transfer this stored presets to an another location or PC, just copy that *.rnp files and you are done.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2589</id>
		<title>ReNamer:Using presets</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2589"/>
		<updated>2014-01-15T06:51:33Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;preset&amp;quot; is a set of rules that is saved with a user-defined name. It can optionally save the [[ReNamer:Menus for the Files pane#Filters_menu|Filter setting]] also. &lt;br /&gt;
&lt;br /&gt;
You can save frequently used sets of rules as presets, and load them instantly. This saves you a lot of time. Without the presets, you would have to compose the same set of rules each time you start the program. You can create an unlimited number of presets, but in practice, you would normally need about 4-5 presets.&lt;br /&gt;
&lt;br /&gt;
== Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
ReNamer automatically assigns keyboard shortcuts to presets, so that they can be loaded into the &#039;&#039;&#039;Rules&#039;&#039;&#039; pane with least effort. Shortcuts have the following form: &#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, &#039;&#039;&#039;CTRL+2&#039;&#039;&#039;, etc. Unfortunately, there are only 9 shortcuts available, one for every digit from 1 to 9.&lt;br /&gt;
&lt;br /&gt;
Presets are sorted in alphabetic order. You can manipulate the order of the presets by renaming them. If you want some specific preset to always appear at the top, you can insert an exclamation mark &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot; (or some other symbol that is at the top of the sorting order) in front of the preset name. If you have several presets that you want to push to the top, you can prefix them with something like this: &amp;quot;&#039;&#039;&#039;!1&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!2&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!3&#039;&#039;&#039;&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
== Managing Presets ==&lt;br /&gt;
&lt;br /&gt;
=== Save a preset ===&lt;br /&gt;
&lt;br /&gt;
# Create a list of rules ([[ReNamer:Managing rules|Managing rules]]).&lt;br /&gt;
# Set the required [[ReNamer:Menus for the Files pane#Filters_menu|Filter settings]] (optional).&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+S&#039;&#039;&#039;, or use the &#039;&#039;&#039;Presets &amp;amp;gt; Save As&#039;&#039;&#039; menu option.&lt;br /&gt;
# A window pops up:&amp;lt;br&amp;gt;[[Image:SavePresetDialog.png|center]]&lt;br /&gt;
# Enter a new name in the &#039;&#039;&#039;Name&#039;&#039;&#039; box, or select one of the existing presets listed below to overwrite it.&lt;br /&gt;
# Put a tick in the check box if you want to save the current filter settings.&lt;br /&gt;
# Press the &#039;&#039;&#039;Save&#039;&#039;&#039; button. The preset is saved. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; At any point of time, you can abort the process by pressing &#039;&#039;&#039;ESC&#039;&#039;&#039; or closing the window.&lt;br /&gt;
&lt;br /&gt;
=== Load an existing preset ===&lt;br /&gt;
&lt;br /&gt;
You can load any of the presets by pressing its shortcut (&#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, etc. see above). If you do not remember the shortcuts, use the&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&#039;&#039;&#039;Preset &amp;amp;gt; Load&#039;&#039;&#039; menu to see the master list of all existing presets and select a preset from that list.The selected preset is loaded.&lt;br /&gt;
&lt;br /&gt;
=== Append an existing preset to current set of rules ===&lt;br /&gt;
&lt;br /&gt;
You can append any of the presets to the end of the current rules stack. To do it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to append and then press the [[Image:Append_preset_button.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Delete an existing preset ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you may not need a preset any longer. To delete it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to delete and then press &#039;&#039;&#039;DEL&#039;&#039;&#039; key or the [[Image:PresetDeleteButton.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Rename a preset ===&lt;br /&gt;
&lt;br /&gt;
To rename a preset, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The Preset manager window pops up.&lt;br /&gt;
# Select the preset you want to rename and then press &#039;&#039;&#039;F2&#039;&#039;&#039; or the [[Image:RenamePresetButton.png]] button.&lt;br /&gt;
# The following dialog pops up:&amp;lt;br&amp;gt;[[Image:RenamePresetDialog.png|center]]&lt;br /&gt;
# Edit the name (or enter a new name), and press &#039;&#039;&#039;OK&#039;&#039;&#039; or &#039;&#039;&#039;ENTER&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To abort the process at any time, press &#039;&#039;&#039;ESC&#039;&#039;&#039; or close the window.&lt;br /&gt;
&lt;br /&gt;
=== Edit a preset ===&lt;br /&gt;
&lt;br /&gt;
The preset manager can show the contents of a preset (i.e., settings of all rules and filters) as editable text. You can simply edit the rules and filters by changing the text.&lt;br /&gt;
&lt;br /&gt;
To edit a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to edit and then press &#039;&#039;&#039;F4&#039;&#039;&#039; or the [[Image:EditPresetButton.png]] button.&lt;br /&gt;
# A warning pops up:&amp;lt;br&amp;gt;[[Image:EditPresetWarning.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. A Notepad (text editor) window pops up with the selected preset:&amp;lt;br&amp;gt;[[Image:PresetEditWindow.png|center]]&lt;br /&gt;
#: Notice that:&lt;br /&gt;
#:* This window shows the preset name in the title bar, and all settings (rules and filters). &lt;br /&gt;
#:* In each rule, the parameters are shown in &#039;&#039;&#039;ParameterName:ParameterValue &#039;&#039;&#039;format. &lt;br /&gt;
#:* All such pairs are separated by a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;).&lt;br /&gt;
# Edit the settings and then close the file. A confirmation dialog pops up.&amp;lt;br&amp;gt;[[Image:SaveChangedmpFileDialog.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. Now the preset is edited. &lt;br /&gt;
&lt;br /&gt;
=== Copy a preset ===&lt;br /&gt;
&lt;br /&gt;
You may want to duplicate an existing preset and create a variation by editing it (or just take a backup of the preset before experimenting with it). &lt;br /&gt;
&lt;br /&gt;
To duplicate a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to duplicate and then press the [[Image:CopyPresetButton.png]] button.&lt;br /&gt;
# A duplicate copy of the preset is created.&lt;br /&gt;
# Now go ahead and edit the original present (or its copy).&lt;br /&gt;
# Finally close the &#039;&#039;&#039;Presets Manager&#039;&#039;&#039; window. &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
== Backup / Transfer Presets ==&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Presets are stored as plain text files, stored by default in a folder called Presets.&amp;lt;BR&amp;gt;&lt;br /&gt;
On default, this Presets folder is in the same folder as the ReNamer.exe,&amp;lt;BR&amp;gt;&lt;br /&gt;
but it could be stored in your Windows user profile too.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can simple tell by launching ReNamer and open the Presets Manager: &amp;quot;Presets &amp;gt; Manage...&amp;quot; (Ctrl+P)&amp;lt;BR&amp;gt;&lt;br /&gt;
On the top you will see the path to the presets folder (see pictures above).&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
There is also a menu item &amp;quot;Presets &amp;gt; Browse...&amp;quot; which will open WinExplorer with that folder in view.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To backup or transfer this stored presets to an another location or PC, just copy that *.rnp files and you are done.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2588</id>
		<title>ReNamer:Using presets</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2588"/>
		<updated>2014-01-15T06:49:57Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;preset&amp;quot; is a set of rules that is saved with a user-defined name. It can optionally save the [[ReNamer:Menus for the Files pane#Filters_menu|Filter setting]] also. &lt;br /&gt;
&lt;br /&gt;
You can save frequently used sets of rules as presets, and load them instantly. This saves you a lot of time. Without the presets, you would have to compose the same set of rules each time you start the program. You can create an unlimited number of presets, but in practice, you would normally need about 4-5 presets.&lt;br /&gt;
&lt;br /&gt;
== Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
ReNamer automatically assigns keyboard shortcuts to presets, so that they can be loaded into the &#039;&#039;&#039;Rules&#039;&#039;&#039; pane with least effort. Shortcuts have the following form: &#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, &#039;&#039;&#039;CTRL+2&#039;&#039;&#039;, etc. Unfortunately, there are only 9 shortcuts available, one for every digit from 1 to 9.&lt;br /&gt;
&lt;br /&gt;
Presets are sorted in alphabetic order. You can manipulate the order of the presets by renaming them. If you want some specific preset to always appear at the top, you can insert an exclamation mark &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot; (or some other symbol that is at the top of the sorting order) in front of the preset name. If you have several presets that you want to push to the top, you can prefix them with something like this: &amp;quot;&#039;&#039;&#039;!1&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!2&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!3&#039;&#039;&#039;&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
== Managing Presets ==&lt;br /&gt;
&lt;br /&gt;
=== Save a preset ===&lt;br /&gt;
&lt;br /&gt;
# Create a list of rules ([[ReNamer:Managing rules|Managing rules]]).&lt;br /&gt;
# Set the required [[ReNamer:Menus for the Files pane#Filters_menu|Filter settings]] (optional).&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+S&#039;&#039;&#039;, or use the &#039;&#039;&#039;Presets &amp;amp;gt; Save As&#039;&#039;&#039; menu option.&lt;br /&gt;
# A window pops up:&amp;lt;br&amp;gt;[[Image:SavePresetDialog.png|center]]&lt;br /&gt;
# Enter a new name in the &#039;&#039;&#039;Name&#039;&#039;&#039; box, or select one of the existing presets listed below to overwrite it.&lt;br /&gt;
# Put a tick in the check box if you want to save the current filter settings.&lt;br /&gt;
# Press the &#039;&#039;&#039;Save&#039;&#039;&#039; button. The preset is saved. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; At any point of time, you can abort the process by pressing &#039;&#039;&#039;ESC&#039;&#039;&#039; or closing the window.&lt;br /&gt;
&lt;br /&gt;
=== Load an existing preset ===&lt;br /&gt;
&lt;br /&gt;
You can load any of the presets by pressing its shortcut (&#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, etc. see above). If you do not remember the shortcuts, use the&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&#039;&#039;&#039;Preset &amp;amp;gt; Load&#039;&#039;&#039; menu to see the master list of all existing presets and select a preset from that list.The selected preset is loaded.&lt;br /&gt;
&lt;br /&gt;
=== Append an existing preset to current set of rules ===&lt;br /&gt;
&lt;br /&gt;
You can append any of the presets to the end of the current rules stack. To do it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to append and then press the [[Image:Append_preset_button.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Delete an existing preset ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you may not need a preset any longer. To delete it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to delete and then press &#039;&#039;&#039;DEL&#039;&#039;&#039; key or the [[Image:PresetDeleteButton.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Rename a preset ===&lt;br /&gt;
&lt;br /&gt;
To rename a preset, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The Preset manager window pops up.&lt;br /&gt;
# Select the preset you want to rename and then press &#039;&#039;&#039;F2&#039;&#039;&#039; or the [[Image:RenamePresetButton.png]] button.&lt;br /&gt;
# The following dialog pops up:&amp;lt;br&amp;gt;[[Image:RenamePresetDialog.png|center]]&lt;br /&gt;
# Edit the name (or enter a new name), and press &#039;&#039;&#039;OK&#039;&#039;&#039; or &#039;&#039;&#039;ENTER&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To abort the process at any time, press &#039;&#039;&#039;ESC&#039;&#039;&#039; or close the window.&lt;br /&gt;
&lt;br /&gt;
=== Edit a preset ===&lt;br /&gt;
&lt;br /&gt;
The preset manager can show the contents of a preset (i.e., settings of all rules and filters) as editable text. You can simply edit the rules and filters by changing the text.&lt;br /&gt;
&lt;br /&gt;
To edit a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to edit and then press &#039;&#039;&#039;F4&#039;&#039;&#039; or the [[Image:EditPresetButton.png]] button.&lt;br /&gt;
# A warning pops up:&amp;lt;br&amp;gt;[[Image:EditPresetWarning.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. A Notepad (text editor) window pops up with the selected preset:&amp;lt;br&amp;gt;[[Image:PresetEditWindow.png|center]]&lt;br /&gt;
#: Notice that:&lt;br /&gt;
#:* This window shows the preset name in the title bar, and all settings (rules and filters). &lt;br /&gt;
#:* In each rule, the parameters are shown in &#039;&#039;&#039;ParameterName:ParameterValue &#039;&#039;&#039;format. &lt;br /&gt;
#:* All such pairs are separated by a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;).&lt;br /&gt;
# Edit the settings and then close the file. A confirmation dialog pops up.&amp;lt;br&amp;gt;[[Image:SaveChangedmpFileDialog.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. Now the preset is edited. &lt;br /&gt;
&lt;br /&gt;
=== Copy a preset ===&lt;br /&gt;
&lt;br /&gt;
You may want to duplicate an existing preset and create a variation by editing it (or just take a backup of the preset before experimenting with it). &lt;br /&gt;
&lt;br /&gt;
To duplicate a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to duplicate and then press the [[Image:CopyPresetButton.png]] button.&lt;br /&gt;
# A duplicate copy of the preset is created.&lt;br /&gt;
# Now go ahead and edit the original present (or its copy).&lt;br /&gt;
# Finally close the &#039;&#039;&#039;Presets Manager&#039;&#039;&#039; window. &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
== Backup / Transfer Presets ==&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Presets are stored in plain text files, stored by default in a folder called Presets.&amp;lt;BR&amp;gt;&lt;br /&gt;
On default, this Presets folder is in the same folder as the ReNamer.exe,&amp;lt;BR&amp;gt;&lt;br /&gt;
but it could be stored in your Windows user profile too.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can simple tell by launching ReNamer and open the Presets Manager: &amp;quot;Presets &amp;gt; Manage...&amp;quot; (Ctrl+P)&amp;lt;BR&amp;gt;&lt;br /&gt;
On the top you will see the path to the presets folder (see pictures above).&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
There is also a menu item &amp;quot;Presets &amp;gt; Browse...&amp;quot; which will open WinExplorer with that folder in view.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To backup or transfer this stored presets to an another location or PC, just copy that *.rnp files and you are done.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2587</id>
		<title>ReNamer:Using presets</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Using_presets&amp;diff=2587"/>
		<updated>2014-01-15T06:48:35Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;preset&amp;quot; is a set of rules that is saved with a user-defined name. It can optionally save the [[ReNamer:Menus for the Files pane#Filters_menu|Filter setting]] also. &lt;br /&gt;
&lt;br /&gt;
You can save frequently used sets of rules as presets, and load them instantly. This saves you a lot of time. Without the presets, you would have to compose the same set of rules each time you start the program. You can create an unlimited number of presets, but in practice, you would normally need about 4-5 presets.&lt;br /&gt;
&lt;br /&gt;
== Shortcuts ==&lt;br /&gt;
&lt;br /&gt;
ReNamer automatically assigns keyboard shortcuts to presets, so that they can be loaded into the &#039;&#039;&#039;Rules&#039;&#039;&#039; pane with least effort. Shortcuts have the following form: &#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, &#039;&#039;&#039;CTRL+2&#039;&#039;&#039;, etc. Unfortunately, there are only 9 shortcuts available, one for every digit from 1 to 9.&lt;br /&gt;
&lt;br /&gt;
Presets are sorted in alphabetic order. You can manipulate the order of the presets by renaming them. If you want some specific preset to always appear at the top, you can insert an exclamation mark &amp;quot;&#039;&#039;&#039;!&#039;&#039;&#039;&amp;quot; (or some other symbol that is at the top of the sorting order) in front of the preset name. If you have several presets that you want to push to the top, you can prefix them with something like this: &amp;quot;&#039;&#039;&#039;!1&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!2&#039;&#039;&#039;&amp;quot;, &amp;quot;&#039;&#039;&#039;!3&#039;&#039;&#039;&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
== Managing Presets ==&lt;br /&gt;
&lt;br /&gt;
=== Save a preset ===&lt;br /&gt;
&lt;br /&gt;
# Create a list of rules ([[ReNamer:Managing rules|Managing rules]]).&lt;br /&gt;
# Set the required [[ReNamer:Menus for the Files pane#Filters_menu|Filter settings]] (optional).&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+S&#039;&#039;&#039;, or use the &#039;&#039;&#039;Presets &amp;amp;gt; Save As&#039;&#039;&#039; menu option.&lt;br /&gt;
# A window pops up:&amp;lt;br&amp;gt;[[Image:SavePresetDialog.png|center]]&lt;br /&gt;
# Enter a new name in the &#039;&#039;&#039;Name&#039;&#039;&#039; box, or select one of the existing presets listed below to overwrite it.&lt;br /&gt;
# Put a tick in the check box if you want to save the current filter settings.&lt;br /&gt;
# Press the &#039;&#039;&#039;Save&#039;&#039;&#039; button. The preset is saved. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; At any point of time, you can abort the process by pressing &#039;&#039;&#039;ESC&#039;&#039;&#039; or closing the window.&lt;br /&gt;
&lt;br /&gt;
=== Load an existing preset ===&lt;br /&gt;
&lt;br /&gt;
You can load any of the presets by pressing its shortcut (&#039;&#039;&#039;CTRL+1&#039;&#039;&#039;, etc. see above). If you do not remember the shortcuts, use the&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;&#039;&#039;&#039;Preset &amp;amp;gt; Load&#039;&#039;&#039; menu to see the master list of all existing presets and select a preset from that list.The selected preset is loaded.&lt;br /&gt;
&lt;br /&gt;
=== Append an existing preset to current set of rules ===&lt;br /&gt;
&lt;br /&gt;
You can append any of the presets to the end of the current rules stack. To do it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to append and then press the [[Image:Append_preset_button.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Delete an existing preset ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you may not need a preset any longer. To delete it, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to delete and then press &#039;&#039;&#039;DEL&#039;&#039;&#039; key or the [[Image:PresetDeleteButton.png]] button.&lt;br /&gt;
# Close the &#039;&#039;&#039;Preset Manager&#039;&#039;&#039; window.&lt;br /&gt;
&lt;br /&gt;
=== Rename a preset ===&lt;br /&gt;
&lt;br /&gt;
To rename a preset, follow these steps:&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The Preset manager window pops up.&lt;br /&gt;
# Select the preset you want to rename and then press &#039;&#039;&#039;F2&#039;&#039;&#039; or the [[Image:RenamePresetButton.png]] button.&lt;br /&gt;
# The following dialog pops up:&amp;lt;br&amp;gt;[[Image:RenamePresetDialog.png|center]]&lt;br /&gt;
# Edit the name (or enter a new name), and press &#039;&#039;&#039;OK&#039;&#039;&#039; or &#039;&#039;&#039;ENTER&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To abort the process at any time, press &#039;&#039;&#039;ESC&#039;&#039;&#039; or close the window.&lt;br /&gt;
&lt;br /&gt;
=== Edit a preset ===&lt;br /&gt;
&lt;br /&gt;
The preset manager can show the contents of a preset (i.e., settings of all rules and filters) as editable text. You can simply edit the rules and filters by changing the text.&lt;br /&gt;
&lt;br /&gt;
To edit a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to edit and then press &#039;&#039;&#039;F4&#039;&#039;&#039; or the [[Image:EditPresetButton.png]] button.&lt;br /&gt;
# A warning pops up:&amp;lt;br&amp;gt;[[Image:EditPresetWarning.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. A Notepad (text editor) window pops up with the selected preset:&amp;lt;br&amp;gt;[[Image:PresetEditWindow.png|center]]&lt;br /&gt;
#: Notice that:&lt;br /&gt;
#:* This window shows the preset name in the title bar, and all settings (rules and filters). &lt;br /&gt;
#:* In each rule, the parameters are shown in &#039;&#039;&#039;ParameterName:ParameterValue &#039;&#039;&#039;format. &lt;br /&gt;
#:* All such pairs are separated by a semicolon (&#039;&#039;&#039;;&#039;&#039;&#039;).&lt;br /&gt;
# Edit the settings and then close the file. A confirmation dialog pops up.&amp;lt;br&amp;gt;[[Image:SaveChangedmpFileDialog.png|center]]&lt;br /&gt;
# Click on &#039;&#039;&#039;Yes&#039;&#039;&#039;. Now the preset is edited. &lt;br /&gt;
&lt;br /&gt;
=== Copy a preset ===&lt;br /&gt;
&lt;br /&gt;
You may want to duplicate an existing preset and create a variation by editing it (or just take a backup of the preset before experimenting with it). &lt;br /&gt;
&lt;br /&gt;
To duplicate a preset, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Press &#039;&#039;&#039;CTRL+M&#039;&#039;&#039; or use the &#039;&#039;&#039;Presets &amp;amp;gt; Manage&#039;&#039;&#039; menu option.&lt;br /&gt;
# The &#039;&#039;&#039;Presets manager&#039;&#039;&#039; window pops up:&amp;lt;br&amp;gt;[[Image:PresetsManager.png|center]]&lt;br /&gt;
# Select the preset you want to duplicate and then press the [[Image:CopyPresetButton.png]] button.&lt;br /&gt;
# A duplicate copy of the preset is created.&lt;br /&gt;
# Now go ahead and edit the original present (or its copy).&lt;br /&gt;
# Finally close the &#039;&#039;&#039;Presets Manager&#039;&#039;&#039; window. &lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
== Backup / Transfer Presets ==&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Presets are stored in plain text files, stored by default in a folder called Presets.&amp;lt;BR&amp;gt;&lt;br /&gt;
On default, this Presets folder is in the same folder as the ReNamer.exe,&amp;lt;BR&amp;gt;&lt;br /&gt;
but it could be stored in your Windows user profile too.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can simple tell by launching ReNamer and open the Presets Manager &amp;quot;Presets &amp;gt; Manage...&amp;quot; (Ctrl+P)&amp;lt;BR&amp;gt;&lt;br /&gt;
On the top you will see the path to the presets folder (see pictures above).&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
There is also a menu item &amp;quot;Presets &amp;gt; Browse...&amp;quot; which will open WinExplorer with that folder in view.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To backup or transfer this stored presets to an another location or PC, just copy that *rnp files and you are done.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2386</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2386"/>
		<updated>2013-01-27T18:00:35Z</updated>

		<summary type="html">&lt;p&gt;Stefan: corrected two mistakes. + Thanks Denis for help!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup|This page is work in process! I want to clean up this page later. If you want to help please do so. -- [[User:Stefan|Stefan]]}}&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them. Also you may want to store an index number, or perhaps a list of the original file names. There are several techniques to store variable values, feel free to choose the one that suits you.&lt;br /&gt;
&lt;br /&gt;
== File Approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== Utilized Function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  vars,v:string;&lt;br /&gt;
  Lines,CurrLine:TStringsArray;&lt;br /&gt;
  i:integer;&lt;br /&gt;
   &lt;br /&gt;
begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registry Approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
&lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v TestName1&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    // Result:&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      TestName1       REG_SZ  Test value 1&lt;br /&gt;
    //  &lt;br /&gt;
      &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value &amp;quot;Test value 1&amp;quot;---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clipboard Approach ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Data: WideString;&lt;br /&gt;
begin&lt;br /&gt;
  SetClipboardText(&#039;Sample Data&#039;);&lt;br /&gt;
  Data := GetClipboardText;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2382</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2382"/>
		<updated>2013-01-27T13:47:39Z</updated>

		<summary type="html">&lt;p&gt;Stefan: corrected two pasted text to make more sense together&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== --- This page is work in process! --- ==&lt;br /&gt;
&lt;br /&gt;
currently i just collect here a few information and POC proof of concept code.&lt;br /&gt;
&lt;br /&gt;
I want to clean up this page later.&lt;br /&gt;
&lt;br /&gt;
If you want to help please do so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Set/Get or Write/Read or Save/Load variable values ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them.&amp;lt;br&amp;gt;&lt;br /&gt;
Also you may want to store an index number, or perhaps a list of the original file names.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two main techniques to store variable values: use the registry or use a temporary file on disc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the file approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== utilized function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath +&#039;\den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
   vars,v:string;&lt;br /&gt;
   Lines,CurrLine:TStringsArray;&lt;br /&gt;
   i:integer;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
 end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the registry approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v Test6&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    // Result:&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      TestName1       REG_SZ  Test value 1&lt;br /&gt;
    //  &lt;br /&gt;
      &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value &amp;quot;Test value 1&amp;quot;---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&lt;br /&gt;
== the clipboard approach ==&lt;br /&gt;
=== no tested yet ===&lt;br /&gt;
 SetClipboardText( &amp;quot;content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
 varClip := GetClipboardText;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-# end&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2381</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2381"/>
		<updated>2013-01-27T13:44:29Z</updated>

		<summary type="html">&lt;p&gt;Stefan: added placeholder for the clipboard approach&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== --- This page is work in process! --- ==&lt;br /&gt;
&lt;br /&gt;
currently i just collect here a few information and POC proof of concept code.&lt;br /&gt;
&lt;br /&gt;
I want to clean up this page later.&lt;br /&gt;
&lt;br /&gt;
If you want to help please do so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Set/Get or Write/Read or Save/Load variable values ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them.&amp;lt;br&amp;gt;&lt;br /&gt;
Also you may want to store an index number, or perhaps a list of the original file names.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two main techniques to store variable values: use the registry or use a temporary file on disc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the file approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== utilized function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath +&#039;\den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
   vars,v:string;&lt;br /&gt;
   Lines,CurrLine:TStringsArray;&lt;br /&gt;
   i:integer;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
 end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the registry approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v Test6&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      Test6       REG_SZ  gut&lt;br /&gt;
    //  &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the clipboard approach ==&lt;br /&gt;
=== no tested yet ===&lt;br /&gt;
 SetClipboardText( &amp;quot;content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
 varClip := GetClipboardText;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-# end&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script&amp;diff=2380</id>
		<title>ReNamer:Pascal Script</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script&amp;diff=2380"/>
		<updated>2013-01-27T13:37:43Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add link at tips to page &amp;quot;ReNamer:Scripts:Reuse variable&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
The [[ReNamer:Rules:PascalScript|PascalScript Rule]] in [[ReNamer]] uses Pascal Script component to allow users to program their own renaming rule. &lt;br /&gt;
&lt;br /&gt;
To master Pascal Script, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Learn the basic syntax and concepts of Pascal Script&lt;br /&gt;
# Understand the specific variables, procedures and functions that are defined within ReNamer&lt;br /&gt;
# Learn how to use these variables/functions/procedures in scripts &lt;br /&gt;
&lt;br /&gt;
Let us see these steps in more details.&lt;br /&gt;
&lt;br /&gt;
== Learn the basics ==&lt;br /&gt;
&lt;br /&gt;
To learn the basics of Pascal Script, please refer to the [[ReNamer:Pascal Script:Quick guide|Pascal Script Quick Guide]].&lt;br /&gt;
&lt;br /&gt;
== Types and functions ==&lt;br /&gt;
&lt;br /&gt;
In this section, we will see all types, procedures and functions which can be used &#039;&#039;within&#039;&#039; ReNamer.&lt;br /&gt;
&lt;br /&gt;
*[[ReNamer:Pascal Script:Types|Types]] &lt;br /&gt;
*[[ReNamer:Pascal Script:Functions|Procedures and functions]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;Note:&amp;lt;/span&amp;gt; Most of these are &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; part of the &amp;quot;standard&amp;quot; Pascal Script, so you will not find them in other applications.&lt;br /&gt;
&lt;br /&gt;
== Script cookbook ==&lt;br /&gt;
&lt;br /&gt;
In this section, we will see how to write scripts for some common renaming tasks. &lt;br /&gt;
&lt;br /&gt;
They also demonstrate how to use ReNamer&#039;s types, procedures and functions. &lt;br /&gt;
&lt;br /&gt;
# [[ReNamer:Pascal Script:FileName|How to rename a file (using the FileName variable)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:FileName Utilities|How to skip extention (basic FileName utilities)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:WideUpperCase|How to convert the filename to ALLCAPS (the WideUpperCase function)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Unicode String Handling Routines|How to operate on words (Unicode string-handling routines)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Basic Conversion Routines|How to serialize files (basic conversion routines)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Initialization of variables|How to initialize variables]] &lt;br /&gt;
# [[ReNamer:Pascal Script:Dialogs|How to create interactive dialogs]]&lt;br /&gt;
# [[ReNamer:Pascal Script:FilePath|How to work with folders and paths (FilePath constant)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Break script execution|How to break the script execution]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Read file content|How to read file content]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Import functions|How to import functions]]&lt;br /&gt;
# [[ReNamer:Pascal Script:SplitPath|How to split file path into parts (folders, base, extension)]]&lt;br /&gt;
&lt;br /&gt;
== Scripts repository  ==&lt;br /&gt;
&lt;br /&gt;
* Official [[ReNamer:Scripts|Scripts Repository]].&lt;br /&gt;
* The [http://www.den4b.com/forum/ Forum] contains several ready scripts.&lt;br /&gt;
&lt;br /&gt;
Study them and adopt them for your purpose.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
A few quick tips: &lt;br /&gt;
&lt;br /&gt;
* In Pascal Script, ReNamer has defined the &#039;&#039;&#039;FileName&#039;&#039;&#039; variable to represent the New Name of the File. &amp;lt;br&amp;gt;Therefore, in your script, you will have to manipulate this variable to change the filename. &lt;br /&gt;
* The &#039;&#039;&#039;FilePath&#039;&#039;&#039; constant holds the original path of the file. It allows you to access the file directly.&amp;lt;br&amp;gt; &lt;br /&gt;
* ReNamer supports UDFs (User-Defined Functions) and also [[ReNamer:Pascal Script:Import functions|importing of external functions from DLLs]].&amp;lt;br&amp;gt;&lt;br /&gt;
* Try to use &#039;&#039;&#039;WideString &#039;&#039;&#039;[[ReNamer:Pascal Script:Types|type]] instead of an ordinary &#039;&#039;&#039;String&#039;&#039;&#039; type. This will allow ReNamer to handle Unicode filenames.&amp;lt;br&amp;gt;(In other words, it will be able to handle non-English scripts, such as Cyrillic, Asian, German, French, etc.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; Do not override ReNamer&#039;s built-in variables, types and functions.&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; Some of the functions are able to alter your file system (create new folders, move files, etc.). So use them with caution! Remember that scripts are executed during Preview (NOT Rename) operation. So you let the script alter your system by pressing Preview or having Auto Preview on.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; The only product of PascalScript that doesn&#039;t affect your files until Rename operation is the content of the FileName variable. &amp;quot;New Name&amp;quot; (and &amp;quot;New Path&amp;quot;) fields of filetable are replaced with this variable content. After Preview you may check if you like them and if you do - press Rename. Only then the actual renaming of the files will take place.&lt;br /&gt;
&lt;br /&gt;
* [[ReNamer:Scripts:Reuse variable‎|See tips how to Store/Load Set/Get Write/Read variable for later reuse]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.remobjects.com/ps RemObjects Pascal Script]&lt;br /&gt;
: Developers of the Pascal Script component.&lt;br /&gt;
* [http://www.delphibasics.co.uk/ Delphi Basics]&lt;br /&gt;
: Help and reference for the fundamentals of the Delphi/Pascal language.&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;br /&gt;
[[Category:Pascal Script]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2379</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2379"/>
		<updated>2013-01-27T13:28:59Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add example to use single file to store many vars/values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== --- This page is work in process! --- ==&lt;br /&gt;
&lt;br /&gt;
currently i just collect here a few information and POC proof of concept code.&lt;br /&gt;
&lt;br /&gt;
I want to clean up this page later.&lt;br /&gt;
&lt;br /&gt;
If you want to help please do so.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Set/Get or Write/Read or Save/Load variable values ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them.&amp;lt;br&amp;gt;&lt;br /&gt;
Also you may want to store an index number, or perhaps a list of the original file names.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two main techniques to store variable values: use the registry or use a temporary file on disc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the file approach ==&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
=== utilized function ===&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== script examples ===&lt;br /&gt;
&lt;br /&gt;
==== Store one value to one dedicated file ====&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath +&#039;\den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Store more then one value into a common file====&lt;br /&gt;
&lt;br /&gt;
Note this approach is to cumbersome for real use. &amp;lt;br&amp;gt;&lt;br /&gt;
Better use dedicated file for each var/value (see above).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also use   FileAppendContent();  to add &amp;quot;NAME=VALUE&amp;quot; pairs to an single file&amp;lt;br&amp;gt;&lt;br /&gt;
and a routine to read the lines of that common vars.txt.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here just as proof of concept:&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(add a line with &amp;quot;NAME=VALUE&amp;quot; pair)&lt;br /&gt;
  FileAppendContent(&#039;den4b_vars.txt&#039;,&#039;LastFolder=&#039; + ParentF + #13#10);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This &#039;den4b_vars.txt&#039; could look now like:&lt;br /&gt;
 LastIndex=10&lt;br /&gt;
 LastString=Vacation 2013&lt;br /&gt;
 LastFolder=Translits&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get the wanted value i would use a code like this:&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
- read the vars.txt&amp;lt;br&amp;gt;&lt;br /&gt;
- split into lines&amp;lt;br&amp;gt;&lt;br /&gt;
- split line into &#039;name&#039; and &#039;value&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
- check if &#039;name&#039; is a wanted var name, if yes get the value&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
   vars,v:string;&lt;br /&gt;
   Lines,CurrLine:TStringsArray;&lt;br /&gt;
   i:integer;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
  if(GetCurrentFileIndex=1)then&lt;br /&gt;
  begin&lt;br /&gt;
    if( WideFileExists(&#039;.\den4b_vars.txt&#039;) ) then&lt;br /&gt;
    begin&lt;br /&gt;
       vars := FileReadContent(&#039;.\den4b_vars.txt&#039;);&lt;br /&gt;
       ShowMessage(&#039;complete content:&#039;+#10+vars);&lt;br /&gt;
       Lines:= WideSplitString(vars, #13#10);&lt;br /&gt;
       if( length(Lines) &amp;gt; 0 ) then&lt;br /&gt;
         begin&lt;br /&gt;
             for i:=0 to length(Lines)-1 do&lt;br /&gt;
             begin&lt;br /&gt;
                CurrLine := WideSplitString(Lines[i],&#039;=&#039;);&lt;br /&gt;
                v := CurrLine[0];&lt;br /&gt;
                //ShowMessage(v);&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastIndex&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; + CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastFolder&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
                if ( WideCompareText( v, &#039;LastString&#039; ) =0) then&lt;br /&gt;
                    ShowMessage( v + &#039; has value &#039; +  CurrLine[1] );&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
    end;&lt;br /&gt;
  end;&lt;br /&gt;
 end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== the registry approach ==&lt;br /&gt;
&lt;br /&gt;
=== Not recommended ! ===&lt;br /&gt;
&lt;br /&gt;
Not recommended !&lt;br /&gt;
&lt;br /&gt;
 var&lt;br /&gt;
  ECAreturn:string;&lt;br /&gt;
   &lt;br /&gt;
 begin&lt;br /&gt;
   // Add your code here&lt;br /&gt;
   &lt;br /&gt;
   //Store/Write/Set:&lt;br /&gt;
    ExecuteProgram(&#039;reg add  HKCU\Software\den4b /v TestName1 /t REG_SZ /d &amp;quot;Test value 1&amp;quot; /f&#039;, true);&lt;br /&gt;
     &lt;br /&gt;
    //Load/Read/Get: &lt;br /&gt;
    ExecConsoleApp(&#039;reg query  HKCU\Software\den4b /v Test6&#039;, ECAreturn);&lt;br /&gt;
    ShowMessage(ECAreturn);&lt;br /&gt;
    //  &lt;br /&gt;
    //  ! REG.EXE VERSION 3.0&lt;br /&gt;
    //  &lt;br /&gt;
    //  HKEY_CURRENT_USER\Software\den4b&lt;br /&gt;
    //      Test6       REG_SZ  gut&lt;br /&gt;
    //  &lt;br /&gt;
    //&amp;gt;---more code needed here to extract the value---&amp;lt;&lt;br /&gt;
end.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-# end&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2378</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2378"/>
		<updated>2013-01-27T12:56:16Z</updated>

		<summary type="html">&lt;p&gt;Stefan: just clean up a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== This page is work in process!==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them.&amp;lt;br&amp;gt;&lt;br /&gt;
Also you may want to store an index number, or perhaps a list of the original file names.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two main techniques to store variable values: use the registry or use a temporary file on disc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==First we take a look on the file approach.==&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&amp;lt;br&amp;gt;&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PascalScript rule examples ==&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath +&#039;\den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other rules here in between&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
-&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&amp;lt;br&amp;gt;&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-#&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2377</id>
		<title>ReNamer:Pascal Script:Reuse variable</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:Reuse_variable&amp;diff=2377"/>
		<updated>2013-01-27T12:49:28Z</updated>

		<summary type="html">&lt;p&gt;Stefan: First content collection - work in process&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== This page is work in process!==&lt;br /&gt;
&lt;br /&gt;
If you want to store a variable to reuse the value later you can read here a few tips.&lt;br /&gt;
&lt;br /&gt;
For examples you can store the last used path, folder or file name or parts of them.&lt;br /&gt;
Also you may want to store an index number, or perhaps a list of the original file names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are two main techniques to store variable values: use the registry or use a temporary file on disc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we take a look on the file approach.&lt;br /&gt;
&lt;br /&gt;
We use simple plain text files to store the variable.&lt;br /&gt;
&lt;br /&gt;
The ReNamer PascalScript functions to write and read text files are:&lt;br /&gt;
&lt;br /&gt;
FileWriteContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileAppendContent( &amp;quot;FileName&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
FileReadContent(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileCountLines(&amp;quot;FileName&amp;quot;);&lt;br /&gt;
FileReadLine( &amp;quot;FileName&amp;quot; , LineNum );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;FileName&amp;quot; you can just use a name without a path to store the file into the ReNamer folder.&lt;br /&gt;
Example:&lt;br /&gt;
FileWriteContent( &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
FileWriteContent( &amp;quot;.\FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use an full path to your ReNamer folder use the ReNamer PascalScript function &amp;quot;GetApplicationPath&amp;quot;&lt;br /&gt;
Example:&lt;br /&gt;
FileWriteContent( WideExtractFilePath(GetApplicationPath) + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use your private temp (temporary) folder in your profile&lt;br /&gt;
by using the ReNamer PascalScript function &amp;quot;WideGetTempPath&amp;quot;&lt;br /&gt;
Example:&lt;br /&gt;
FileWriteContent( WideGetTempPath + &amp;quot;FileName.txt&amp;quot; , &amp;quot;Content&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Also you can access all system environment variables by using &amp;quot;WideGetEnvironmentVar&amp;quot;&lt;br /&gt;
Example:&lt;br /&gt;
  UserName := WideGetEnvironmentVar(&#039;USERNAME&#039;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PascalScript rule examples ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First rule in rule list:&lt;br /&gt;
(GET stored variable &#039;LastFolder&#039;)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  LastFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=1)then&lt;br /&gt;
    if(WideFileExists(WideGetTempPath +&#039;\den4b_LastFolder.txt&#039;)) then&lt;br /&gt;
        LastFold := FileReadContent(WideGetTempPath +&#039;den4b_LastFolder.txt&#039;);&lt;br /&gt;
&lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ShowMessage(LastFold);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last rule in rule list:&lt;br /&gt;
(SET variable &#039;LastFolder&#039; to stored for later reuse)&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  ParentFold:string;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
 if(GetCurrentFileIndex=GetTotalNumberOfFiles)then&lt;br /&gt;
   begin&lt;br /&gt;
       ParentFold := CalculateMetaTag(FilePath, &#039;File_FolderName&#039;);&lt;br /&gt;
       FileWriteContent(WideGetTempPath + &#039;den4b_LastFolder.txt&#039;, ParentFold);&lt;br /&gt;
   end;&lt;br /&gt;
 &lt;br /&gt;
  //check if it works:&lt;br /&gt;
  ExecuteProgram(&#039;notepad &#039; + WideGetTempPath + &#039;\den4b_LastFolder.txt&#039;,false);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Scripts&amp;diff=2376</id>
		<title>ReNamer:Scripts</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Scripts&amp;diff=2376"/>
		<updated>2013-01-27T12:09:14Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add link to Get/Set variable page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer:Pascal Script}}&lt;br /&gt;
&lt;br /&gt;
This page contains a collection of scripts which can be used in [[ReNamer]]&#039;s [[ReNamer:Rules:PascalScript|PascalScript rule]].&lt;br /&gt;
&lt;br /&gt;
== Educational scripts ==&lt;br /&gt;
 &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Script&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Initialize|Initialize]]&lt;br /&gt;
| How to initialize the code.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Import DLL|Import DLL]]&lt;br /&gt;
| Demonstrates how to call functions of 3rd party DLL.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Date and Time|Date and Time]]&lt;br /&gt;
| How to use date and time of the file.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Move filename portion|Move filename portion]]&lt;br /&gt;
| How to move part of the filename to a new position.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Index filenames|Index filenames]]&lt;br /&gt;
| How to insert an incrementing number into the filename.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Reuse variable|Reuse variable]]&lt;br /&gt;
| See techniques to store/set and to read/get variable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 3rd party libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Script&lt;br /&gt;
! Description&lt;br /&gt;
! Forum Link&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:TrID|TrID]]&lt;br /&gt;
| Detecting file extension.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=550&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Xpdf|Xpdf]]&lt;br /&gt;
| Extract PDF tags.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=349&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Exiv2|Exiv2]]&lt;br /&gt;
| Extract EXIF/IPTC/XMP tags from any images.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=407&amp;lt;br/&amp;gt;http://www.den4b.com/forum/viewtopic.php?id=109&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== User scripts  ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Script &lt;br /&gt;
! Description &lt;br /&gt;
! Forum Link&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Separate words|Separate words]]&lt;br /&gt;
| Insert a space in front of each capitalized letter.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?pid=2529#p2529&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:AVI video codec|AVI video codec]]&lt;br /&gt;
| Extract name of video codec used encoding AVI file.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?pid=3484#p3484&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:RegEx Case Convertion|RegEx Case Convertion]]&lt;br /&gt;
| Convert case of capturing groups of your regular expression.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?pid=3454#p3454&amp;lt;br/&amp;gt;http://www.den4b.com/forum/viewtopic.php?pid=3459#p3459&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Using MasterFile|Using MasterFile]]&lt;br /&gt;
| Renaming folder basing on the MetaTag of the first file in the folder. In this particular case: adding the ID3_Year metatag from the mp3 file to it&#039;s parent folder name.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?pid=1626#p1626&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Hours span|Hours span]]&lt;br /&gt;
| Add hours to a date embedded in the filename in format &amp;quot;yyyy-mm-dd hh-nn-ss.JPG&amp;quot;.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=696&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Roman numerals serialization|Roman numerals serialization]]&lt;br /&gt;
| Serialization with Roman numerals.&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=828&amp;lt;br/&amp;gt;http://www.den4b.com/forum/viewtopic.php?pid=3327#p3327&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:EAN-13|EAN-13 checksum]]&lt;br /&gt;
| Calculate the checksum digit for the [http://en.wikipedia.org/wiki/EAN-13 EAN-13 barcode].&lt;br /&gt;
| http://www.den4b.com/forum/viewtopic.php?id=930&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Serialize duplicates|Serialize duplicates]]&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| Serialize duplicated filenames by append a counter to the filename.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Partial case change|Partial case change]]&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| Change case of specific parts of the file name.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:URL decode|URL decode]]&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| Decode a URL encoded filename.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Index files per folder|Index files per folder]]&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| This script adds a serialization index to the end of every file on per folder basis. The index is incremented only when the folder path changes.&lt;br /&gt;
|-&lt;br /&gt;
| [[ReNamer:Scripts:Random characters and length|Random characters and length]]&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| Generate new names consisting of random selection of characters and of random length.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer&amp;diff=2327</id>
		<title>ReNamer</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer&amp;diff=2327"/>
		<updated>2012-08-16T08:25:49Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Changes some wording about &amp;quot;Menus for the Files pane&amp;quot; for better finding&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:ReNamer.png|thumb|250px]] &lt;br /&gt;
&lt;br /&gt;
[[ReNamer]] is a very powerful and flexible file renaming tool.&lt;br /&gt;
&lt;br /&gt;
ReNamer offers all the standard renaming procedures, including prefixes, suffixes, replacements, case changes, removing the content inside brackets, adding number sequences, changing file extensions, etc. &lt;br /&gt;
&lt;br /&gt;
Advanced users can program their own algorithm using [[ReNamer:Rules:PascalScript|PascalScript]] rule. &lt;br /&gt;
&lt;br /&gt;
ReNamer allows you to combine multiple renaming actions as a rule set, which can be saved, re-loaded, and edited. In addition, it can rename folders and process regular expressions. It can handle Unicode (non-English scripts). &lt;br /&gt;
&lt;br /&gt;
ReNamer supports a variety of meta tags, such as: [http://en.wikipedia.org/wiki/ID3 ID3v1], [http://en.wikipedia.org/wiki/ID3 ID3v2], [http://en.wikipedia.org/wiki/EXIF EXIF], [http://en.wikipedia.org/wiki/Object_Linking_and_Embedding OLE], [http://msdn.microsoft.com/en-us/library/ms779636.aspx AVI], [http://en.wikipedia.org/wiki/MD5 MD5], [http://en.wikipedia.org/wiki/CRC32 CRC32], [http://en.wikipedia.org/wiki/SHA1 SHA1] and many more. &lt;br /&gt;
&lt;br /&gt;
== User Manual ==&lt;br /&gt;
&lt;br /&gt;
{{Beta}}&lt;br /&gt;
&lt;br /&gt;
{{Open book|Book:ReNamer_User_Manual|Open the book and download this manual as a PDF}}&lt;br /&gt;
&lt;br /&gt;
*[[ReNamer:Introduction|Introduction]] &lt;br /&gt;
*[[ReNamer:Quick Guide|Quick Guide]] &lt;br /&gt;
*[[ReNamer:Step-by-step|Step-by-step]] &lt;br /&gt;
**[[ReNamer:Adding files and folders|Adding files and folders]] &lt;br /&gt;
**[[ReNamer:Managing rules|Managing rules]] &lt;br /&gt;
**[[ReNamer:Previewing files|Previewing files]] &lt;br /&gt;
**[[ReNamer:Renaming files|Renaming files]] &lt;br /&gt;
*[[ReNamer:Using the Rules|Using the Rules]] &lt;br /&gt;
**[[ReNamer:Rules|Overview]] &lt;br /&gt;
**[[ReNamer:Rules:Insert|Insert]] &lt;br /&gt;
**[[ReNamer:Rules:Delete|Delete]] &lt;br /&gt;
**[[ReNamer:Rules:Remove|Remove]] &lt;br /&gt;
**[[ReNamer:Rules:Replace|Replace]]&lt;br /&gt;
**[[ReNamer:Rules:Rearrange|Rearrange]] ([[ReNamer:Rules:Rearrange Examples|Examples]])&lt;br /&gt;
**[[ReNamer:Rules:Extension|Extension]] &lt;br /&gt;
**[[ReNamer:Rules:Strip|Strip]] &lt;br /&gt;
**[[ReNamer:Rules:Case|Case]] &lt;br /&gt;
**[[ReNamer:Rules:Serialize|Serialize]] &lt;br /&gt;
**[[ReNamer:Rules:CleanUp|CleanUp]] &lt;br /&gt;
**[[ReNamer:Rules:Translit|Translit]] &lt;br /&gt;
**[[ReNamer:Rules:RegEx|RegEx]] &lt;br /&gt;
**[[ReNamer:Rules:PascalScript|PascalScript]] &lt;br /&gt;
**[[ReNamer:Rules:UserInput|UserInput]] &lt;br /&gt;
*[[ReNamer:Using presets|Using presets]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze window]] &lt;br /&gt;
*[[ReNamer:Manual editing|Manual editing]]&lt;br /&gt;
&lt;br /&gt;
== Appendices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[ReNamer:Program settings|Program settings]] &lt;br /&gt;
*[[ReNamer:Main Menu and keyboard shortcuts|Main Menu and keyboard shortcuts]] &lt;br /&gt;
*[[ReNamer:Menus for the Files pane|Files Pane Menu (Files Filters Export Options)]]&lt;br /&gt;
*[[ReNamer:Context menus|Context menus]]&lt;br /&gt;
*[[ReNamer:Date and Time format|Date and Time format]]&lt;br /&gt;
*[[ReNamer:Binary Signatures|Binary Signatures]] &lt;br /&gt;
*[[ReNamer:Meta Tags|Meta Tags]]&lt;br /&gt;
*[[ReNamer:Analyze|Analyze dialog]]&lt;br /&gt;
*[[ReNamer:Regular Expressions|Regular Expressions]] &lt;br /&gt;
*[[ReNamer:Pascal Script|Pascal Script]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Quick guide|Quick guide]]&lt;br /&gt;
**[[ReNamer:Pascal Script:Types|Types]] &lt;br /&gt;
**[[ReNamer:Pascal Script:Functions|Functions]]&lt;br /&gt;
**[[ReNamer:Pascal_Script#Script cookbook|Script cookbook]]  &lt;br /&gt;
**[[ReNamer:Scripts|Scripts]] &lt;br /&gt;
*[[ReNamer:Command Line|Command Line]] &lt;br /&gt;
*[[ReNamer:Sorting files|Sorting files]]&lt;br /&gt;
*[[ReNamer:Masks|Using masks]]&lt;br /&gt;
*[[ReNamer:Renaming folders|Renaming folders]]&lt;br /&gt;
*[[ReNamer:Renaming to another folder|Renaming to another folder (or sorting files into multiple folders)]]&lt;br /&gt;
*[[ReNamer:Failed renaming|Failed renaming]]&lt;br /&gt;
*[[ReNamer:Validation|Validation]]&lt;br /&gt;
*[[ReNamer:Skip extension|Skip extension]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=2244</id>
		<title>ReNamer:Rules:UserInput</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=2244"/>
		<updated>2011-10-11T15:19:24Z</updated>

		<summary type="html">&lt;p&gt;Stefan: little modification on my examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:PascalScript}}&lt;br /&gt;
&lt;br /&gt;
[[Image:UserInputRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule replaces the original filenames with the names taken from the list. (The &#039;&#039;n&#039;&#039;th line in the list serves as the new name for the &#039;&#039;n&#039;&#039;th file in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane.) &lt;br /&gt;
&lt;br /&gt;
Naturally, the list should contain names for all the files loaded in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane. &lt;br /&gt;
&lt;br /&gt;
*If the list is shorter, then some of the files will not be renamed. &lt;br /&gt;
*If the list is longer, some of the names will remain unused (but all files in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane will be renamed).&lt;br /&gt;
&lt;br /&gt;
There are three ways to create the list: &lt;br /&gt;
&lt;br /&gt;
#Click in the pane, and manually type the list (one name per line). &lt;br /&gt;
#Copy the list from any application to your clipboard. Switch to ReNamer. Click in the &#039;&#039;&#039;UserInput&#039;&#039;&#039; pane and press &#039;&#039;&#039;CTRL+V&#039;&#039;&#039;, right-click and select &#039;&#039;&#039;Paste&#039;&#039;&#039; or choose the &#039;&#039;&#039;Load from clipboard&#039;&#039;&#039; from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
#Load a list from the text file (available from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
&lt;br /&gt;
The optional parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Insert in front of the current name &lt;br /&gt;
| Inserts the name before the file name.&lt;br /&gt;
|-&lt;br /&gt;
| Insert after the current name &lt;br /&gt;
| Inserts the name &#039;&#039;after&#039;&#039; the current name. The actual position depends on the &#039;&#039;&#039;Skip extension&#039;&#039;&#039; option.&lt;br /&gt;
|-&lt;br /&gt;
| Replace the current name &lt;br /&gt;
| Replaces the existing filename with the new name. &lt;br /&gt;
The effect on extension depends on the &#039;&#039;&#039;&#039;&#039;Skip extension&#039;&#039;&#039;&#039;&#039; option: &lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
|&lt;br /&gt;
*If the option is selected, the extension is ignored and user input strings will affect only the base name of files.&lt;br /&gt;
*If the option is deselected, user input strings will replace entire filename, &#039;&#039;including&#039;&#039; the extension, or will be added &#039;&#039;after&#039;&#039; the old extension (if the &#039;&#039;&#039;Insert after the current name&#039;&#039;&#039; option is selected).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example and warning==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;Warning&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
The list of new names must exactly match the list of current files, one-by-one.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Current Name column&lt;br /&gt;
! your NewName-list&lt;br /&gt;
|-&lt;br /&gt;
| Old name 1&lt;br /&gt;
| new name for old name 1&lt;br /&gt;
|-&lt;br /&gt;
| Old name 2&lt;br /&gt;
| new name for old name 2&lt;br /&gt;
|-&lt;br /&gt;
| Old name 3&lt;br /&gt;
| new name for old name 3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Or in other words: the amount of items in your NewName list should match the current amount of items in the Name column. (see example below for clarifying)&lt;br /&gt;
&lt;br /&gt;
Hint: Your NewName list must only contain the new names! &amp;lt;BR&amp;gt;&lt;br /&gt;
Not the old names too, as maybe seen with other renamers like &amp;quot;old|new&amp;quot; or &amp;quot;old=new&amp;quot; or like that.&lt;br /&gt;
&lt;br /&gt;
For example, if you have this three files:&amp;lt;BR&amp;gt;&lt;br /&gt;
Old name 1&amp;lt;BR&amp;gt;&lt;br /&gt;
Old name 2&amp;lt;BR&amp;gt;&lt;br /&gt;
Old name 3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then your NewName list should contain exactly three lines like:&amp;lt;BR&amp;gt;&lt;br /&gt;
new name for old name 1&amp;lt;BR&amp;gt;&lt;br /&gt;
new name for old name 2&amp;lt;BR&amp;gt;&lt;br /&gt;
new name for old name 3&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;Examples for clarifying:&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example 1&amp;lt;BR&amp;gt;&lt;br /&gt;
File list (Current Name) is longer then new name list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name column&lt;br /&gt;
! NewName-list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| &amp;lt;will not be renamed&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example 2&amp;lt;BR&amp;gt;&lt;br /&gt;
New name list is longer then file list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name column&lt;br /&gt;
! NewName-list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;unused&amp;gt;&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example 3&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;B&amp;gt;TAKE CARE!&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
Missed item in new name list;&amp;lt;B&amp;gt; your file names will get messed-up:&amp;lt;/B&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name column&lt;br /&gt;
! NewName-list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| Fifth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=2243</id>
		<title>ReNamer:Rules:UserInput</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Rules:UserInput&amp;diff=2243"/>
		<updated>2011-10-11T06:22:01Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Added Examples&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Go|up=ReNamer:Rules|prev=ReNamer:Rules:PascalScript}}&lt;br /&gt;
&lt;br /&gt;
[[Image:UserInputRule.png|center]]&lt;br /&gt;
&lt;br /&gt;
This rule replaces the original filenames with the names taken from the list. (The &#039;&#039;n&#039;&#039;th line in the list serves as the new name for the &#039;&#039;n&#039;&#039;th file in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane.) &lt;br /&gt;
&lt;br /&gt;
Naturally, the list should contain names for all the files loaded in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane. &lt;br /&gt;
&lt;br /&gt;
*If the list is shorter, then some of the files will not be renamed. &lt;br /&gt;
*If the list is longer, some of the names will remain unused (but all files in the &#039;&#039;&#039;Files&#039;&#039;&#039; pane will be renamed).&lt;br /&gt;
&lt;br /&gt;
There are three ways to create the list: &lt;br /&gt;
&lt;br /&gt;
#Click in the pane, and manually type the list (one name per line). &lt;br /&gt;
#Copy the list from any application to your clipboard. Switch to ReNamer. Click in the &#039;&#039;&#039;UserInput&#039;&#039;&#039; pane and press &#039;&#039;&#039;CTRL+V&#039;&#039;&#039;, right-click and select &#039;&#039;&#039;Paste&#039;&#039;&#039; or choose the &#039;&#039;&#039;Load from clipboard&#039;&#039;&#039; from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
#Load a list from the text file (available from [[Image:UserInputOptionsButton.png]] menu).&lt;br /&gt;
&lt;br /&gt;
The optional parameters are as follows: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Insert in front of the current name &lt;br /&gt;
| Inserts the name before the file name.&lt;br /&gt;
|-&lt;br /&gt;
| Insert after the current name &lt;br /&gt;
| Inserts the name &#039;&#039;after&#039;&#039; the current name. The actual position depends on the &#039;&#039;&#039;Skip extension&#039;&#039;&#039; option.&lt;br /&gt;
|-&lt;br /&gt;
| Replace the current name &lt;br /&gt;
| Replaces the existing filename with the new name. &lt;br /&gt;
The effect on extension depends on the &#039;&#039;&#039;&#039;&#039;Skip extension&#039;&#039;&#039;&#039;&#039; option: &lt;br /&gt;
|-&lt;br /&gt;
| Skip extension &lt;br /&gt;
|&lt;br /&gt;
*If the option is selected, the extension is ignored and user input strings will affect only the base name of files.&lt;br /&gt;
*If the option is deselected, user input strings will replace entire filename, &#039;&#039;including&#039;&#039; the extension, or will be added &#039;&#039;after&#039;&#039; the old extension (if the &#039;&#039;&#039;Insert after the current name&#039;&#039;&#039; option is selected).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example and warning==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;Warning&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
The list of new names must exactly match the list of current files, one-by-one.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Current Name&lt;br /&gt;
! Name list&lt;br /&gt;
|-&lt;br /&gt;
| Old name 1&lt;br /&gt;
| new name for old name 1&lt;br /&gt;
|-&lt;br /&gt;
| Old name 2&lt;br /&gt;
| new name for old name 2&lt;br /&gt;
|-&lt;br /&gt;
| Old name 3&lt;br /&gt;
| new name for old name 3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hint: The new name list must only contain the new names! &amp;lt;BR&amp;gt;&lt;br /&gt;
Not the old names too, as maybe seen with other renamers like &amp;quot;old|new&amp;quot; or &amp;quot;old=new&amp;quot; or like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;Examples&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
File list (Current Name) is longer then new name list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Current Name&lt;br /&gt;
! Name list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| &amp;lt;will not be renamed&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New name list is longer then file list:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Current Name&lt;br /&gt;
! Name list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Second.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;unused&amp;gt;&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;B&amp;gt;TAKE CARE!&amp;lt;/B&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
Missed item in new name list;&amp;lt;B&amp;gt; your file names will get messed-up:&amp;lt;/B&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Current Name&lt;br /&gt;
! Name list&lt;br /&gt;
|-&lt;br /&gt;
| One.txt&lt;br /&gt;
| First.txt&lt;br /&gt;
|-&lt;br /&gt;
| Two.txt&lt;br /&gt;
| Third.txt&lt;br /&gt;
|-&lt;br /&gt;
| Three.txt&lt;br /&gt;
| Fourth.txt&lt;br /&gt;
|-&lt;br /&gt;
| Four.txt&lt;br /&gt;
| Fifth.txt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2208</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2208"/>
		<updated>2011-08-18T08:29:13Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Corrected again an mistake (arrrrggh)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| .ext (dot included)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath  &amp;gt;&amp;gt;&amp;gt; &#039; + vPath   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir   &amp;gt;&amp;gt;&amp;gt; &#039; + vDir    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039; + vDrive  + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName  &amp;gt;&amp;gt;&amp;gt; &#039; + vName   + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName  &amp;gt;&amp;gt;&amp;gt; &#039; + vBase   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt   &amp;gt;&amp;gt;&amp;gt; &#039; + vExt;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;, without using an var first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_backup&#039; + WideExtractFileExt(FilePath);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
(Here for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Other tricks:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To get the extension without the dot use something like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 vExt := WideReplaceStr(WideExtractFileExt(FilePath), &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or showing this as step by step:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vExt   := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way to get the name of an parent folder of an path&amp;lt;BR&amp;gt;&lt;br /&gt;
by splitting the path at the back slash into an array of &#039;Folders&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
We use&amp;lt;BR&amp;gt;&lt;br /&gt;
Folders: TStringsArray; &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Folders := WideSplitString( WideExtractFileDir(FilePath), at sign &#039;\&#039;)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
to get the elements of such an path.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then we can access each level of parent folders&amp;lt;BR&amp;gt;&lt;br /&gt;
by referring to the right element in the array.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that an array start counting at &#039;0&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
And if you try to access an array element that is not there,&amp;lt;BR&amp;gt;&lt;br /&gt;
you will get an error message &amp;quot;Exception: Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Again for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
there are 4 elements in the array, counting from &#039;0&#039; to &#039;3&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| Folders[0]&lt;br /&gt;
| C:&lt;br /&gt;
|-&lt;br /&gt;
| Folders[1]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[3]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|}&lt;br /&gt;
If you not know how deep the folder hierarchy is, you may want to count from the right.&amp;lt;BR&amp;gt; &lt;br /&gt;
Therefor we can utilize the max. amount of elements in an array. We use the &#039;Length&#039; attribute here.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Length(Folders)&amp;quot; is &#039;4&#039;. But Folders[4] is for our example path &amp;quot;Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
That is why we use &amp;quot;Length(Folders) -1&amp;quot; to get &#039;3&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So to get the last element in array use &amp;quot;Folders[ Length(Folders) -1 ]&amp;quot;, which is here the same as &amp;quot;Folders[ 3 ]&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
And so we can use &#039;-1&#039; (4 -1 = 3) till &#039;-4&#039; (4 -4 = 0) for our example path. (remember: we have 4 elements, from &#039;0&#039; to &#039;3&#039;.)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-1]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-3]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-4]&lt;br /&gt;
| C:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder + &#039;-&#039; + GrandParentFolder + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tip:&amp;lt;BR&amp;gt;&lt;br /&gt;
You can use ShowMessage() like MsgBox to be prompte what the elements contains:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage(&#039;Debug: &#039; + Folders[1] + &#039; # &#039; + Folders[Length(Folders)-1] );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To loop trough each element of an part (e.g. to check if an given folder exists)&amp;lt;BR&amp;gt;&lt;br /&gt;
you may take an look at this example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  I: Integer;  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
//function WideSplitString(const Input, Delimiter: WideString): TStringsArray;&lt;br /&gt;
  Parts := WideSplitString(FilePath, &#039;\&#039;);&lt;br /&gt;
  for I:=0 to Length(Parts)-1 do&lt;br /&gt;
  begin&lt;br /&gt;
    // access each part via Parts[i]&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you could use Regular Expression to extract the parts of an part:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use Meta Tags to extract e.g. the parent folder:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File name&lt;br /&gt;
&lt;br /&gt;
To split the &amp;lt;b&amp;gt;file name&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
into parts at an given delimiter&amp;lt;BR&amp;gt;&lt;br /&gt;
we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split an file name with regular expression you can use something like this:&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you have to adjust the RegEx by your needs, according to your real file names.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
  Parts := SubMatchesRegEx(WideExtractBaseName(FileName), &#039;(.)(.+_)(.+_)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
 FileName := WideUpperCase(Parts[0]) + Parts[1] + WideUpperCase(Parts[2]) + Parts[3]  + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we are using RegEx and WideCopy() to split an string into parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For an example file name like&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - Laura (Bonus).mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
our message will look like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - #  Laura (Bonus).mp3&amp;quot;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  Base, Part1, Part2: WideString;  &lt;br /&gt;
begin&lt;br /&gt;
  Base := WideExtractBaseName(FileName);&lt;br /&gt;
&lt;br /&gt;
  //Find last &#039;-&#039; by greedy RegEx:&lt;br /&gt;
  Parts := SubMatchesRegEx(Base, &#039;(.+-)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
  //Split file name into two:&lt;br /&gt;
  Part1 := WideCopy( Base,       1            , Length(Parts[0]) );&lt;br /&gt;
  Part2 := WideCopy( Base, Length(Parts[0]) +1,         999      );&lt;br /&gt;
&lt;br /&gt;
  WideShowMessage(Part1 + &#039; # &#039; + Part2  + WideExtractFileExt(FileName));&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
How did this works?&amp;lt;BR&amp;gt;&lt;br /&gt;
See yourself:&amp;lt;BR&amp;gt;&lt;br /&gt;
Add to the code, right under &amp;lt;BR&amp;gt;&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&amp;lt;BR&amp;gt;&lt;br /&gt;
this two commands:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage( Parts[0] );&lt;br /&gt;
ShowMessage(  IntToStr(  Length(Parts[0]) ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or with more infos:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ShowMessage( &#039;=&#039; + Parts[0] + &#039;=&#039;      + #13#10 + &#039;=&#039; + Parts[1] + &#039;=&#039; );&lt;br /&gt;
ShowMessage( IntToStr(Length(Parts[0]))  +#13#10+   IntToStr(Length(Parts[1])) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Hints:&amp;lt;BR&amp;gt;&lt;br /&gt;
Putting the &#039;=&#039; -signs (or similar) around the content will let you spot additional spaces more easier.&amp;lt;BR&amp;gt;&lt;br /&gt;
Since &amp;quot;Length(Parts[n])&amp;quot; will provide an number/digit, and ShowMessage() only allows chars, we have to convert &#039;Int-to-Chars&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then you will see that&amp;lt;BR&amp;gt;&lt;br /&gt;
Parts[0] will hold &amp;quot;Dzenan Loncarevic - 2009 - 10 -&amp;quot; and&amp;lt;BR&amp;gt;&lt;br /&gt;
the length of this string in &#039;Parts[0]&#039; is &#039;31&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So we can use this info as parameter for WideCopy().&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Ahh, yes: the &#039;999&#039; for &#039;Part2&#039; just means: &amp;quot;give me all till the end&amp;quot;, since an average file name is 25 chars only. Maybe &#039;100&#039;, but not &#039;999&#039;, isn&#039;t it?&amp;lt;BR&amp;gt;&lt;br /&gt;
And with this little trick ReNamer gives me all chars till the end, no matter how many that are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also use Split() to split an file name into parts:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
// Swaps FileName-parts at minus-sign.pas&lt;br /&gt;
// FROM: &amp;quot;Artist - Song.mp3&amp;quot;&lt;br /&gt;
// TO: &amp;quot;Song - Artist.mp3&amp;quot;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  SplitSign: String;  &lt;br /&gt;
  Count: integer;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  // sign to split the file name, e.g. for &amp;quot;Artist - Song.mp3&amp;quot; we split at &#039; - &#039;&lt;br /&gt;
     SplitSign = &#039; - &#039;;&lt;br /&gt;
&lt;br /&gt;
  //Trick to ask the user for an delimiter. Using &#039;count&#039; var to prompt only once.&lt;br /&gt;
     //If count &amp;lt; 1 Then&lt;br /&gt;
        //SplitSign := InputBox(&#039;Split FileName&#039;, &#039;Insert the sign where you want to split the FileName into parts:&#039;, SplitSign);&lt;br /&gt;
       //Count := 2&lt;br /&gt;
&lt;br /&gt;
  // split the filename at &#039;-&#039; into parts:&lt;br /&gt;
     Parts := WideSplitString(WideExtractBaseName(FileName), SplitSign);&lt;br /&gt;
     // Note: parts are numbered in array from 0 on: 0, 1, 2, 3... So first part has the index &#039;0&#039;&lt;br /&gt;
&lt;br /&gt;
  // build your new name:&lt;br /&gt;
     // Here: second part[1]  first, then SpaceMinusSpace, then the first part[0]:&lt;br /&gt;
     FileName := Parts[1] + &#039; - &#039; + Parts[0] + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Please note: to split file name you can use also the Arrange Rule (see ReNamer beta and the wiki about rules)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2207</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2207"/>
		<updated>2011-08-18T08:21:50Z</updated>

		<summary type="html">&lt;p&gt;Stefan: More examples how to split file name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| .ext (dot included)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath  &amp;gt;&amp;gt;&amp;gt; &#039; + vPath   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir   &amp;gt;&amp;gt;&amp;gt; &#039; + vDir    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039; + vDrive  + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName  &amp;gt;&amp;gt;&amp;gt; &#039; + vName   + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName  &amp;gt;&amp;gt;&amp;gt; &#039; + vBase   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt   &amp;gt;&amp;gt;&amp;gt; &#039; + vExt;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;, without using an var first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_backup&#039; + WideExtractFileExt(FilePath);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
(Here for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Other tricks:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To get the extension without the dot use something like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 vExt := WideReplaceStr(WideExtractFileExt(FilePath), &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or showing this as step by step:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vExt   := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way to get the name of an parent folder of an path&amp;lt;BR&amp;gt;&lt;br /&gt;
by splitting the path at the back slash into an array of &#039;Folders&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
We use&amp;lt;BR&amp;gt;&lt;br /&gt;
Folders: TStringsArray; &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Folders := WideSplitString( WideExtractFileDir(FilePath), at sign &#039;\&#039;)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
to get the elements of such an path.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then we can access each level of parent folders&amp;lt;BR&amp;gt;&lt;br /&gt;
by referring to the right element in the array.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that an array start counting at &#039;0&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
And if you try to access an array element that is not there,&amp;lt;BR&amp;gt;&lt;br /&gt;
you will get an error message &amp;quot;Exception: Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Again for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
there are 4 elements in the array, counting from &#039;0&#039; to &#039;3&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| Folders[0]&lt;br /&gt;
| C:&lt;br /&gt;
|-&lt;br /&gt;
| Folders[1]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[3]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|}&lt;br /&gt;
If you not know how deep the folder hierarchy is, you may want to count from the right.&amp;lt;BR&amp;gt; &lt;br /&gt;
Therefor we can utilize the max. amount of elements in an array. We use the &#039;Length&#039; attribute here.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Length(Folders)&amp;quot; is &#039;4&#039;. But Folders[4] is for our example path &amp;quot;Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
That is why we use &amp;quot;Length(Folders) -1&amp;quot; to get &#039;3&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So to get the last element in array use &amp;quot;Folders[ Length(Folders) -1 ]&amp;quot;, which is here the same as &amp;quot;Folders[ 3 ]&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
And so we can use &#039;-1&#039; (4 -1 = 3) till &#039;-4&#039; (4 -4 = 0) for our example path. (remember: we have 4 elements, from &#039;0&#039; to &#039;3&#039;.)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-1]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-3]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-4]&lt;br /&gt;
| C:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder + &#039;-&#039; + GrandParentFolder + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tip:&amp;lt;BR&amp;gt;&lt;br /&gt;
You can use ShowMessage() like MsgBox to be prompte what the elements contains:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage(&#039;Debug: &#039; + Folders[1] + &#039; # &#039; + Folders[Length(Folders)-1] );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To loop trough each element of an part (e.g. to check if an given folder exists)&amp;lt;BR&amp;gt;&lt;br /&gt;
you may take an look at this example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  I: Integer;  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
//function WideSplitString(const Input, Delimiter: WideString): TStringsArray;&lt;br /&gt;
  Parts := WideSplitString(FilePath, &#039;\&#039;);&lt;br /&gt;
  for I:=0 to Length(Parts)-1 do&lt;br /&gt;
  begin&lt;br /&gt;
    // access each part via Parts[i]&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you could use Regular Expression to extract the parts of an part:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use Meta Tags to extract e.g. the parent folder:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File name&lt;br /&gt;
&lt;br /&gt;
To split the &amp;lt;b&amp;gt;file name&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
into parts at an given delimiter&amp;lt;BR&amp;gt;&lt;br /&gt;
we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split an file name with regular expression you can use something like this:&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you have to adjust the RegEx by your needs, according to your real file names.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
  Parts := SubMatchesRegEx(WideExtractBaseName(FileName), &#039;(.)(.+_)(.+_)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
 FileName := WideUpperCase(Parts[0]) + Parts[1] + WideUpperCase(Parts[2]) + Parts[3]  + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we are using RegEx and WideCopy() to split an string into parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For an example file name like&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - Laura (Bonus).mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
our message will look like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - #  Laura (Bonus).mp3&amp;quot;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  Base, Part1, Part2: WideString;  &lt;br /&gt;
begin&lt;br /&gt;
  Base := WideExtractBaseName(FileName);&lt;br /&gt;
&lt;br /&gt;
  //Find last &#039;-&#039; by greedy RegEx:&lt;br /&gt;
  Parts := SubMatchesRegEx(Base, &#039;(.+-)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
  //Split file name into two:&lt;br /&gt;
  Part1 := WideCopy( Base,       1            , Length(Parts[0]) );&lt;br /&gt;
  Part2 := WideCopy( Base, Length(Parts[0]) +1,         999      );&lt;br /&gt;
&lt;br /&gt;
  WideShowMessage(Part1 + &#039; # &#039; + Part2  + WideExtractFileExt(FileName));&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
How did this works?&amp;lt;BR&amp;gt;&lt;br /&gt;
See yourself:&amp;lt;BR&amp;gt;&lt;br /&gt;
Add to the code, right under &amp;lt;BR&amp;gt;&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&amp;lt;BR&amp;gt;&lt;br /&gt;
this two commands:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage( Parts[0] );&lt;br /&gt;
ShowMessage(  IntToStr(  Length(Parts[0]) ) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or with more infos:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ShowMessage( &#039;=&#039; + Parts[0] + &#039;=&#039;      + #13#10 + &#039;=&#039; + Parts[1] + &#039;=&#039; );&lt;br /&gt;
ShowMessage( IntToStr(Length(Parts[0]))  +#13#10+   IntToStr(Length(Parts[1])) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Hints:&amp;lt;BR&amp;gt;&lt;br /&gt;
Putting the &#039;=&#039; -signs (or similar) around the content will let you spot additional spaces more easier.&amp;lt;BR&amp;gt;&lt;br /&gt;
Since &amp;quot;Length(Parts[n])&amp;quot; will provide an number/digit, and ShowMessage() only allows chars, we have to convert &#039;Int-to-Chars&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then you will see that&amp;lt;BR&amp;gt;&lt;br /&gt;
Parts[0] will hold &amp;quot;Dzenan Loncarevic - 2009 - 10 -&amp;quot; and&amp;lt;BR&amp;gt;&lt;br /&gt;
the length of this string in &#039;Parts[0]&#039; is &#039;31&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So we can use this info as parameter for WideCopy().&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Ahh, yes: the &#039;999&#039; for &#039;Part2&#039; just means: &amp;quot;give me all till the end&amp;quot;, since an average file name is 25 chars only. Maybe &#039;100&#039;, but not &#039;999&#039;, isn&#039;t it?&amp;lt;BR&amp;gt;&lt;br /&gt;
And with this little trick ReNamer gives me all chars till the end, no matter how many that are.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can also use Split() to split an file name into parts:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
// Swaps FileName-parts at minus-sign.pas&lt;br /&gt;
// FROM: &amp;quot;Artist - Song.mp3&amp;quot;&lt;br /&gt;
// TO: &amp;quot;Song - Artist.mp3&amp;quot;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  SplitSign: String;  &lt;br /&gt;
  Count: integer;&lt;br /&gt;
&lt;br /&gt;
begin&lt;br /&gt;
&lt;br /&gt;
  // sign to split the file name, e.g. for &amp;quot;Artist - Song.mp3&amp;quot; we split at &#039; - &#039;&lt;br /&gt;
     SplitSign = &#039; - &#039;;&lt;br /&gt;
&lt;br /&gt;
  //Trick to ask the user for an delimiter. Using &#039;count&#039; var to prompt only once.&lt;br /&gt;
     //If count &amp;lt; 1 Then&lt;br /&gt;
        //SplitSign := InputBox(&#039;Split FileName&#039;, &#039;Insert the sign where you want to split the FileName into parts:&#039;, SplitSign);&lt;br /&gt;
       //Count := 2&lt;br /&gt;
&lt;br /&gt;
  // split the filename at &#039;-&#039; into parts:&lt;br /&gt;
     Parts := WideSplitString(WideExtractBaseName(FileName), vUserInput);&lt;br /&gt;
     // Note: parts are numbered in array from 0 on: 0, 1, 2, 3... So first part has the index &#039;0&#039;&lt;br /&gt;
&lt;br /&gt;
  // build your new name:&lt;br /&gt;
     // Here: second part[1]  first, then SpaceMinusSpace, then the first part[0]:&lt;br /&gt;
     FileName := Parts[1] + &#039; - &#039; + Parts[0] + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Please note: to split file name you can use also the Arrange Rule (see ReNamer beta and the wiki about rules)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2205</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2205"/>
		<updated>2011-08-18T06:47:39Z</updated>

		<summary type="html">&lt;p&gt;Stefan: &amp;quot;~~~&amp;quot; was expanded to &amp;quot;Stefan&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| .ext (dot included)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath  &amp;gt;&amp;gt;&amp;gt; &#039; + vPath   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir   &amp;gt;&amp;gt;&amp;gt; &#039; + vDir    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039; + vDrive  + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName  &amp;gt;&amp;gt;&amp;gt; &#039; + vName   + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName  &amp;gt;&amp;gt;&amp;gt; &#039; + vBase   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt   &amp;gt;&amp;gt;&amp;gt; &#039; + vExt;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;, without using an var first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_backup&#039; + WideExtractFileExt(FilePath);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
(Here for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Other tricks:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To get the extension without the dot use something like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 vExt := WideReplaceStr(WideExtractFileExt(FilePath), &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or showing this as step by step:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vExt   := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way to get the name of an parent folder of an path&amp;lt;BR&amp;gt;&lt;br /&gt;
by splitting the path at the back slash into an array of &#039;Folders&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
We use&amp;lt;BR&amp;gt;&lt;br /&gt;
Folders: TStringsArray; &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Folders := WideSplitString( WideExtractFileDir(FilePath), at sign &#039;\&#039;)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
to get the elements of such an path.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then we can access each level of parent folders&amp;lt;BR&amp;gt;&lt;br /&gt;
by referring to the right element in the array.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that an array start counting at &#039;0&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
And if you try to access an array element that is not there,&amp;lt;BR&amp;gt;&lt;br /&gt;
you will get an error message &amp;quot;Exception: Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Again for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
there are 4 elements in the array, counting from &#039;0&#039; to &#039;3&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| Folders[0]&lt;br /&gt;
| C:&lt;br /&gt;
|-&lt;br /&gt;
| Folders[1]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[3]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|}&lt;br /&gt;
If you not know how deep the folder hierarchy is, you may want to count from the right.&amp;lt;BR&amp;gt; &lt;br /&gt;
Therefor we can utilize the max. amount of elements in an array. We use the &#039;Length&#039; attribute here.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Length(Folders)&amp;quot; is &#039;4&#039;. But Folders[4] is for our example path &amp;quot;Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
That is why we use &amp;quot;Length(Folders) -1&amp;quot; to get &#039;3&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So to get the last element in array use &amp;quot;Folders[ Length(Folders) -1 ]&amp;quot;, which is here the same as &amp;quot;Folders[ 3 ]&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
And so we can use &#039;-1&#039; (4 -1 = 3) till &#039;-4&#039; (4 -4 = 0) for our example path. (remember: we have 4 elements, from &#039;0&#039; to &#039;3&#039;.)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-1]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-3]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-4]&lt;br /&gt;
| C:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder + &#039;-&#039; + GrandParentFolder + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tip:&amp;lt;BR&amp;gt;&lt;br /&gt;
You can use ShowMessage() like MsgBox to be prompte what the elements contains:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage(&#039;Debug: &#039; + Folders[1] + &#039; # &#039; + Folders[Length(Folders)-1] );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To loop trough each element of an part (e.g. to check if an given folder exists)&amp;lt;BR&amp;gt;&lt;br /&gt;
you may take an look at this example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  I: Integer;  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
//function WideSplitString(const Input, Delimiter: WideString): TStringsArray;&lt;br /&gt;
  Parts := WideSplitString(FilePath, &#039;\&#039;);&lt;br /&gt;
  for I:=0 to Length(Parts)-1 do&lt;br /&gt;
  begin&lt;br /&gt;
    // access each part via Parts[i]&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you could use Regular Expression to extract the parts of an part:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use Meta Tags to extract e.g. the parent folder:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File name&lt;br /&gt;
&lt;br /&gt;
To split the &amp;lt;b&amp;gt;file name&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
into parts at an given delimiter&amp;lt;BR&amp;gt;&lt;br /&gt;
we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split an file name with regular expression you can use something like this:&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you have to adjust the RegEx by your needs, according to your real file names.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
  Parts := SubMatchesRegEx(WideExtractBaseName(FileName), &#039;(.)(.+_)(.+_)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
 FileName := WideUpperCase(Parts[0]) + Parts[1] + WideUpperCase(Parts[2]) + Parts[3]  + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we are using RegEx and WideCopy() to split an string into parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For an example file name like&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - Laura (Bonus).mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
our message will look like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - #  Laura (Bonus).mp3&amp;quot;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  Base, Part1, Part2: WideString;  &lt;br /&gt;
begin&lt;br /&gt;
  Base := WideExtractBaseName(FileName);&lt;br /&gt;
&lt;br /&gt;
  //Find last &#039;-&#039; by greedy RegEx:&lt;br /&gt;
  Parts := SubMatchesRegEx(Base, &#039;(.+-)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
  //Split file name into two:&lt;br /&gt;
  Part1 := WideCopy( Base,       1            , Length(Parts[0]) );&lt;br /&gt;
  Part2 := WideCopy( Base, Length(Parts[0]) +1,         999      );&lt;br /&gt;
&lt;br /&gt;
  WideShowMessage(Part1 + &#039; # &#039; + Part2  + WideExtractFileExt(FileName));&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2204</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2204"/>
		<updated>2011-08-18T06:45:16Z</updated>

		<summary type="html">&lt;p&gt;Stefan: First clean up. Then more examples.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| .ext (dot included)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath  &amp;gt;&amp;gt;&amp;gt; &#039; + vPath   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir   &amp;gt;&amp;gt;&amp;gt; &#039; + vDir    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039; + vDrive  + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName  &amp;gt;&amp;gt;&amp;gt; &#039; + vName   + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName  &amp;gt;&amp;gt;&amp;gt; &#039; + vBase   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt   &amp;gt;&amp;gt;&amp;gt; &#039; + vExt;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;, without using an var first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_backup&#039; + WideExtractFileExt(FilePath);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
(Here for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Other tricks:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To get the extension without the dot use something like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 vExt := WideReplaceStr(WideExtractFileExt(FilePath), &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or showing this as step by step:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vExt   := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way to get the name of an parent folder of an path&amp;lt;BR&amp;gt;&lt;br /&gt;
by splitting the path at the back slash into an array of &#039;Folders&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
We use&amp;lt;BR&amp;gt;&lt;br /&gt;
Folders: TStringsArray; &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Folders := WideSplitString( WideExtractFileDir(FilePath), at sign &#039;\&#039;)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
to get the elements of such an path.&amp;lt;BR&amp;gt;&lt;br /&gt;
Then we can access each level of parent folders&amp;lt;BR&amp;gt;&lt;br /&gt;
by referring to the right element in the array.&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that an array start counting at &#039;0&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
And if you try to access an array element that is not there,&amp;lt;BR&amp;gt;&lt;br /&gt;
you will get an error message &amp;quot;Exception: Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Again for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
there are 4 elements in the array, counting from &#039;0&#039; to &#039;3&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| Folders[0]&lt;br /&gt;
| C:&lt;br /&gt;
|-&lt;br /&gt;
| Folders[1]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[3]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|}&lt;br /&gt;
If you not know how deep the folder hierarchy is, you may want to count from the right.&amp;lt;BR&amp;gt; &lt;br /&gt;
Therefor we can utilize the max. amount of elements in an array. We use the &#039;Length&#039; attribute here.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Length(Folders)&amp;quot; is &#039;4&#039;. But Folders[4] is for our example path &amp;quot;Out Of Range&amp;quot;.&amp;lt;BR&amp;gt;&lt;br /&gt;
That is why we use &amp;quot;Length(Folders) -1&amp;quot; to get &#039;3&#039;.&amp;lt;BR&amp;gt;&lt;br /&gt;
So to get the last element in array use &amp;quot;Folders[ Length(Folders) -1 ]&amp;quot;, which is here the same as &amp;quot;Folders[ 3 ]&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
And so we can use &#039;-1&#039; (4 -1 = 3) till &#039;-4&#039; (4 -4 = 0) for our example path. (remember: we have 4 elements, from &#039;0&#039; to &#039;3&#039;.)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Array level&lt;br /&gt;
! provides the folder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-1]&lt;br /&gt;
| ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-2]&lt;br /&gt;
| GrandParent&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-3]&lt;br /&gt;
| GreatGrand&lt;br /&gt;
|-&lt;br /&gt;
| Folders[Length(Folders)-4]&lt;br /&gt;
| C:&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder + &#039;-&#039; + GrandParentFolder + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tip:&amp;lt;BR&amp;gt;&lt;br /&gt;
You can use ShowMessage() like MsgBox to be prompte what the elements contains:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ShowMessage(&#039;Debug: &#039; + Folders[1] + &#039; # &#039; + Folders[Length(Folders)-1] );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To loop trough each element of an part (e.g. to check if an given folder exists)&amp;lt;BR&amp;gt;&lt;br /&gt;
you may take an look at this example:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  I: Integer;  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
//function WideSplitString(const Input, Delimiter: WideString): TStringsArray;&lt;br /&gt;
  Parts := WideSplitString(FilePath, &#039;\&#039;);&lt;br /&gt;
  for I:=0 to Length(Parts)-1 do&lt;br /&gt;
  begin&lt;br /&gt;
    // access each part via Parts[i]&lt;br /&gt;
  end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you could use Regular Expression to extract the parts of an part:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use Meta Tags to extract e.g. the parent folder:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File name&lt;br /&gt;
&lt;br /&gt;
To split the &amp;lt;b&amp;gt;file name&amp;lt;/b&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
into parts at an given delimiter&amp;lt;BR&amp;gt;&lt;br /&gt;
we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split an file name with regular expression you can use something like this:&amp;lt;BR&amp;gt;&lt;br /&gt;
Note that you have to adjust the RegEx by your needs, according to your real file names.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
begin&lt;br /&gt;
  Parts := SubMatchesRegEx(WideExtractBaseName(FileName), &#039;(.)(.+_)(.+_)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
 FileName := WideUpperCase(Parts[0]) + Parts[1] + WideUpperCase(Parts[2]) + Parts[3]  + WideExtractFileExt(FileName);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we are using RegEx and WideCopy() to split an string into parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
For an example file name like&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - Laura (Bonus).mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
our message will look like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;Dzenan Loncarevic - 2009 - 10 - [[User:Stefan|Stefan]]   Laura (Bonus).mp3&amp;quot;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var&lt;br /&gt;
  Parts: TStringsArray;&lt;br /&gt;
  Base, Part1, Part2: WideString;  &lt;br /&gt;
begin&lt;br /&gt;
  Base := WideExtractBaseName(FileName);&lt;br /&gt;
&lt;br /&gt;
  //Find last &#039;-&#039; by greedy RegEx:&lt;br /&gt;
  Parts := SubMatchesRegEx(Base, &#039;(.+-)(.+)&#039;, FALSE);&lt;br /&gt;
  If (Length(Parts) &amp;lt;=0) then exit;&lt;br /&gt;
&lt;br /&gt;
  //Split file name into two:&lt;br /&gt;
  Part1 := WideCopy( Base,       1            , Length(Parts[0]) );&lt;br /&gt;
  Part2 := WideCopy( Base, Length(Parts[0]) +1,         999      );&lt;br /&gt;
&lt;br /&gt;
  WideShowMessage(Part1 + &#039; ~~~ &#039; + Part2  + WideExtractFileExt(FileName));&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2203</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2203"/>
		<updated>2011-08-17T19:56:03Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Arrrghh, another little glitch.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| .ext (dot included)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039; + vDrive  + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir   &amp;gt;&amp;gt;&amp;gt; &#039; + vDir    + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath  &amp;gt;&amp;gt;&amp;gt; &#039; + vPath   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName  &amp;gt;&amp;gt;&amp;gt; &#039; + vName   + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName  &amp;gt;&amp;gt;&amp;gt; &#039; + vBase   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt   &amp;gt;&amp;gt;&amp;gt; &#039; + vExt;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_backup&#039; + WideExtractFileExt(FilePath);&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
(for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
To get the extension without the dot use something like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 vExt := WideReplaceStr(WideExtractFileExt(FilePath), &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or step by step:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vExt   := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way by splitting the path at the back slash into an array &#039;Folders&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
&lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there is Regular Expression to extract the parts:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there are Meta Tags to extract e.g. the parent folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split file name into parts at an delimiter we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2202</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2202"/>
		<updated>2011-08-17T19:40:21Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Clean up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Cleanup}}&lt;br /&gt;
&lt;br /&gt;
Find an overview of all build-in functions there &amp;gt;&amp;gt; [[ReNamer:Pascal_Script:Functions#File_Name_Utilities|File Name Utilities]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here on this page we show you only the needed functions to extract parts&amp;lt;BR&amp;gt;&lt;br /&gt;
of the file name and how to use them in an PascalScript for ReNamer.&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We like to show you this on an example file name&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, there are the always available variables &#039;FilePath&#039; and &#039;FileName&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
You don&#039;t have to declare (&#039;var&#039; / &#039;dim&#039;) or initialize (&#039;var=&amp;quot;&amp;quot;;&#039;) this variables.&amp;lt;BR&amp;gt;&lt;br /&gt;
Just use them, they are always there for you.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vExt: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  vExt     := WideExtractFileExt(FilePath);&lt;br /&gt;
  FileName := FileName + &#039;.backup&#039; + vExt;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
And there are this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| ext&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can fill an variable with the extracted part first&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vE     := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        +  #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039;+ vDrive   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir &amp;gt;&amp;gt;&amp;gt; &#039;  + vDir     + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath &amp;gt;&amp;gt;&amp;gt; &#039; + vPath    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName &amp;gt;&amp;gt;&amp;gt; &#039; + vName    + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName &amp;gt;&amp;gt;&amp;gt; &#039; + vBase    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt &amp;gt;&amp;gt;&amp;gt; &#039;  + vExt     + #13#10&lt;br /&gt;
        + &#039;And without the dot &amp;gt;&amp;gt;&amp;gt; &#039; + vE;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Or just use the function &#039;on the fly&#039;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
begin &lt;br /&gt;
  FileName := FileName + &#039;_from(&#039; + WideExtractFileDrive(FilePath) + &#039;)&#039;;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First we show you an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
Here we extract the path first &amp;quot;WideExtractFileDir(FilePath)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
and then extract the last part, which is normal the filename, but here the parent folder &amp;quot;WideExtractFileName(...)&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
You can even use this trick more then once:&amp;lt;BR&amp;gt;&lt;br /&gt;
(for our example &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder     := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent      := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName         := GreatGrandParent + &#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way by splitting the path at the back slash into an array &#039;Folders&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
&lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath                := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders                := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder +&#039;-&#039; + GrandParent + &#039;-&#039; + ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there is Regular Expression to extract the parts:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent       := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;,         &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa      := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;,     &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature. But then you will see this first for more then thousand files ;-)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there are Meta Tags to extract e.g. the parent folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split file name into parts at an delimiter we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
We split the file name at the dash and then modify the case different for the part before, and the part after the dash.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName),                 1, PosOfDelimiter -2 );&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName)  );&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1,      1           );&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2) -1 );&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=Talk:ReNamer:Pascal_Script:SplitPath&amp;diff=2201</id>
		<title>Talk:ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=Talk:ReNamer:Pascal_Script:SplitPath&amp;diff=2201"/>
		<updated>2011-08-17T19:00:30Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Created page with &amp;quot;What have to cleaned up? Should i do smtg?&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;What have to cleaned up? Should i do smtg?&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2199</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2199"/>
		<updated>2011-08-17T07:50:46Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add another example code how to use functions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Find the build-in functions there &amp;gt; http://www.den4b.com/wiki/ReNamer:Pascal_Script:Functions#File_Name_Utilities&lt;br /&gt;
&lt;br /&gt;
That are:&lt;br /&gt;
&lt;br /&gt;
For e.g. &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The always available variable &#039;FilePath&#039; and &#039;FileName&#039;:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
And this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| ext&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this e.g. like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  vPath, vDir, vDrive, vName, vBase, vExt, vE: WideString;&lt;br /&gt;
  vOUT: WideString; &lt;br /&gt;
begin&lt;br /&gt;
 &lt;br /&gt;
  //extract the parts and store them into an var each:&lt;br /&gt;
  vPath  := WideExtractFilePath(FilePath);&lt;br /&gt;
  vDir   := WideExtractFileDir(FilePath);&lt;br /&gt;
  vDrive := WideExtractFileDrive(FilePath);&lt;br /&gt;
  vName  := WideExtractFileName(FilePath);&lt;br /&gt;
  vBase  := WideExtractBaseName(FilePath);&lt;br /&gt;
  vExt   := WideExtractFileExt(FilePath);&lt;br /&gt;
  vE     := WideReplaceStr( vExt, &#039;.&#039;, &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
  // Test output as MsgBox:&lt;br /&gt;
  vOUT  := &#039;Default build-in vars:&#039;             + #13#10&lt;br /&gt;
        + &#039;FilePath &amp;gt;&amp;gt;&amp;gt; &#039;            + FilePath + #13#10&lt;br /&gt;
        + &#039;FileName &amp;gt;&amp;gt;&amp;gt; &#039;            + FileName + #13#10&lt;br /&gt;
        + #13#10&lt;br /&gt;
        + &#039;Extracted by using functions:&#039;       + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDrive &amp;gt;&amp;gt;&amp;gt; &#039;+ vDrive   + #13#10&lt;br /&gt;
        + &#039;WideExtractFileDir &amp;gt;&amp;gt;&amp;gt; &#039;  + vDir     + #13#10&lt;br /&gt;
        + &#039;WideExtractFilePath &amp;gt;&amp;gt;&amp;gt; &#039; + vPath    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileName &amp;gt;&amp;gt;&amp;gt; &#039; + vName    + #13#10&lt;br /&gt;
        + &#039;WideExtractBaseName &amp;gt;&amp;gt;&amp;gt; &#039; + vBase    + #13#10&lt;br /&gt;
        + &#039;WideExtractFileExt &amp;gt;&amp;gt;&amp;gt; &#039;  + vExt     + #13#10&lt;br /&gt;
        + &#039;And without the dot &amp;gt;&amp;gt;&amp;gt; &#039; + vE;&lt;br /&gt;
       ShowMessage( vOUT );&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName := GreatGrandParent +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way by splitting the path at the back slash into an array &#039;Folders&#039;:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
&lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there is Regular Expression to extract the parts:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there are Meta Tags to extract e.g. the parent folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split file name into parts at an delimiter we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName), 1, PosOfDelimiter -2);&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName));&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1, 1);&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2)-1);&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2198</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2198"/>
		<updated>2011-08-17T07:15:19Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Tried some formating :-(&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Find the build-in functions there &amp;gt; http://www.den4b.com/wiki/ReNamer:Pascal_Script:Functions#File_Name_Utilities&lt;br /&gt;
&lt;br /&gt;
That are:&lt;br /&gt;
&lt;br /&gt;
For e.g. &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The always available variable &#039;FilePath&#039; and &#039;FileName&#039;:&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Variable &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| FilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
|-&lt;br /&gt;
| FileName &lt;br /&gt;
| file.ext&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&amp;lt;BR&amp;gt;&lt;br /&gt;
And this functions to extract parts:&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Function&lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFilePath&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDir&lt;br /&gt;
| C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileDrive&lt;br /&gt;
| C:\&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName&lt;br /&gt;
| file.ext&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractBaseName&lt;br /&gt;
| file&lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileExt&lt;br /&gt;
| ext&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! nested Functions &lt;br /&gt;
! provides &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(FilePath)); &lt;br /&gt;
| ParentFolder &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); &lt;br /&gt;
| GrandParent &lt;br /&gt;
|-&lt;br /&gt;
| WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); &lt;br /&gt;
| GreatGrand &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName := GreatGrandParent +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is an another way by splitting the path at the back slash into an array &#039;Folders&#039;:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
&lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there is Regular Expression to extract the parts:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And there are Meta Tags to extract e.g. the parent folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To split file name into parts at an delimiter we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName), 1, PosOfDelimiter -2);&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName));&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1, 1);&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2)-1);&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2197</id>
		<title>ReNamer:Pascal Script:SplitPath</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script:SplitPath&amp;diff=2197"/>
		<updated>2011-08-17T06:46:43Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Add some examples to split path and file into parts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Find the build-in functions there &amp;gt; http://www.den4b.com/wiki/ReNamer:Pascal_Script:Functions#File_Name_Utilities&lt;br /&gt;
&lt;br /&gt;
That are:&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;C:\GreatGrand\GrandParent\ParentFolder\file.ext&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The always available variable &#039;FilePath&#039; and &#039;FileName&#039;:&lt;br /&gt;
*  FilePath &amp;gt; C:\GreatGrand\GrandParent\ParentFolder\file.ext&lt;br /&gt;
*  FileName &amp;gt; file.ext&lt;br /&gt;
&lt;br /&gt;
And this functions to extract parts:&lt;br /&gt;
*  WideExtractFilePath ==&amp;gt; C:\GreatGrand\GrandParent\ParentFolder\&lt;br /&gt;
*  WideExtractFileDir ==&amp;gt; C:\GreatGrand\GrandParent\ParentFolder&lt;br /&gt;
*  WideExtractFileDrive ==&amp;gt; C:\&lt;br /&gt;
*  WideExtractFileName ==&amp;gt; file.ext&lt;br /&gt;
*  WideExtractBaseName ==&amp;gt; file&lt;br /&gt;
*  WideExtractFileExt ===&amp;gt; ext&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
---------------------&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
But this functions didn&#039;t gave all possibilities to split an full path into all wanted parts.&amp;lt;BR&amp;gt;&lt;br /&gt;
You have to know how to handle this functions and/or use own code to achieve what you want.&amp;lt;BR&amp;gt;&lt;br /&gt;
Here are some code snippets for this issue:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
First an &#039;trick&#039; seen by Denis:&amp;lt;BR&amp;gt;&lt;br /&gt;
*  WideExtractFileName(WideExtractFileDir(FilePath)); ==&amp;gt; ParentFolder&lt;br /&gt;
*  WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath))); ==&amp;gt; GrandParent&lt;br /&gt;
*  WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath)))); ==&amp;gt; GreatGrand&lt;br /&gt;
&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
Use this like:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  ParentFolder, GrandParent, GreatGrandParent: WideString;&lt;br /&gt;
begin &lt;br /&gt;
  ParentFolder := WideExtractFileName(WideExtractFileDir(FilePath));&lt;br /&gt;
  GrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(FilePath)));&lt;br /&gt;
  GreatGrandParent := WideExtractFileName(WideExtractFileDir(WideExtractFileDir(WideExtractFileDir(FilePath))));&lt;br /&gt;
  FileName := GreatGrandParent +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an another way by splitting the path at the back slash into an array &#039;Folders&#039;:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var &lt;br /&gt;
  Folders: TStringsArray; &lt;br /&gt;
  oldPath, ParentFolder, GrandParentFolder, GrandGrandParentFolder, TopMostFolder, SecondTopMostFolder: WideString;&lt;br /&gt;
&lt;br /&gt;
begin &lt;br /&gt;
&lt;br /&gt;
    // Get parts of the current file path:&lt;br /&gt;
  oldPath := WideExtractFileDir(FilePath);&lt;br /&gt;
  Folders := WideSplitString(oldPath, &#039;\&#039;); &lt;br /&gt;
  TopMostFolder          := Folders[1];&lt;br /&gt;
  SecondTopMostFolder    := Folders[2];&lt;br /&gt;
  GrandGrandParentFolder := Folders[Length(Folders)-3];&lt;br /&gt;
  GrandParentFolder      := Folders[Length(Folders)-2];&lt;br /&gt;
  ParentFolder           := Folders[Length(Folders)-1];&lt;br /&gt;
&lt;br /&gt;
  FileName := SecondTopMostFolder +&#039;-&#039;+GrandParent + &#039;-&#039;+ParentFolder + &#039;-&#039; + FileName;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there is Regular Expression to extract the parts:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
  Parent := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
  GrandGrandPa := ReplaceRegEx(FilePath, &#039;.+\\(.+)\\.+\\.+\\.+&#039;, &#039;$1&#039;, False, True);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But note that RegEx is slow by its nature.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
And there are Meta Tags to extract e.g. the parent folder&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
ParentFolder := CalculateMetaTag(FilePath, &#039;:File_FolderName:&#039;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See &#039;Insert&#039; Rule and click there at &#039;Insert Meta Tag&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To split file name into parts at an delimiter we can use f.ex.:&lt;br /&gt;
&lt;br /&gt;
E.g. for&amp;lt;BR&amp;gt;&lt;br /&gt;
FROM:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;my fav artist - title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
TO:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;quot;My Fav Artist - Title album song.mp3&amp;quot;&amp;lt;BR&amp;gt;&lt;br /&gt;
Use:&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
var  &lt;br /&gt;
  Delimiter, Extension, Part1, Part2, Part2Char1, Part2Rest: WideString;&lt;br /&gt;
  PosOfDelimiter: Integer;&lt;br /&gt;
begin&lt;br /&gt;
  Delimiter := &#039;-&#039;;&lt;br /&gt;
  PosOfDelimiter := Pos(Delimiter, FileName);&lt;br /&gt;
&lt;br /&gt;
  if (PosOfDelimiter &amp;gt; 0) then&lt;br /&gt;
    begin&lt;br /&gt;
       Extension  := WideExtractFileExt(FileName)&lt;br /&gt;
       Part1      := WideCopy(WideExtractBaseName(FileName), 1, PosOfDelimiter -2);&lt;br /&gt;
       Part2      := WideCopy(WideExtractBaseName(FileName), PosOfDelimiter +2, Length(FileName));&lt;br /&gt;
       Part2Char1 := WideCopy(Part2, 1, 1);&lt;br /&gt;
       Part2Rest  := WideCopy(Part2, 2, Length(Part2)-1);&lt;br /&gt;
&lt;br /&gt;
       //ShowMessage(&#039;Debug: #&#039; + Part1 + &#039;#&#039; + Part2 + &#039;#&#039;  + Part2Char1 + &#039;#&#039; + Part2Rest + &#039;#&#039;);&lt;br /&gt;
&lt;br /&gt;
       FileName := WideCaseCapitalize(Part1)&lt;br /&gt;
                  + &#039; &#039; + Delimiter + &#039; &#039;&lt;br /&gt;
                  + WideUpperCase(Part2Char1) + WideLowerCase(Part2Rest)&lt;br /&gt;
                  + WideUpperCase(Extension);&lt;br /&gt;
    end;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---------------------&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script&amp;diff=2196</id>
		<title>ReNamer:Pascal Script</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Pascal_Script&amp;diff=2196"/>
		<updated>2011-08-17T05:54:08Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Some examples how to split an file path into its parts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
The [[ReNamer:Rules:PascalScript|PascalScript Rule]] in [[ReNamer]] uses Pascal Script component to allow users to program their own renaming rule. &lt;br /&gt;
&lt;br /&gt;
To master Pascal Script, follow these steps: &lt;br /&gt;
&lt;br /&gt;
# Learn the basic syntax and concepts of Pascal Script&lt;br /&gt;
# Understand the specific variables, procedures and functions that are defined within ReNamer&lt;br /&gt;
# Learn how to use these variables/functions/procedures in scripts &lt;br /&gt;
&lt;br /&gt;
Let us see these steps in more details.&lt;br /&gt;
&lt;br /&gt;
== Learn the basics ==&lt;br /&gt;
&lt;br /&gt;
To learn the basics of Pascal Script, please refer to the [[ReNamer:Pascal Script:Quick guide|Pascal Script Quick Guide]].&lt;br /&gt;
&lt;br /&gt;
== Types and functions ==&lt;br /&gt;
&lt;br /&gt;
In this section, we will see all types, procedures and functions which can be used &#039;&#039;within&#039;&#039; ReNamer.&lt;br /&gt;
&lt;br /&gt;
*[[ReNamer:Pascal Script:Types|Types]] &lt;br /&gt;
*[[ReNamer:Pascal Script:Functions|Procedures and functions]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;Note:&amp;lt;/span&amp;gt; Most of these are &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; part of the &amp;quot;standard&amp;quot; Pascal Script, so you will not find them in other applications.&lt;br /&gt;
&lt;br /&gt;
== Script cookbook ==&lt;br /&gt;
&lt;br /&gt;
In this section, we will see how to write scripts for some common renaming tasks. &lt;br /&gt;
&lt;br /&gt;
They also demonstrate how to use ReNamer&#039;s types, procedures and functions. &lt;br /&gt;
&lt;br /&gt;
# [[ReNamer:Pascal Script:FileName|How to rename a file (using the FileName variable)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:FileName Utilities|How to skip extention (basic FileName utilities)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:WideUpperCase|How to convert the filename to ALLCAPS (the WideUpperCase function)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Unicode String Handling Routines|How to operate on words (Unicode string-handling routines)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Basic Conversion Routines|How to serialize files (basic conversion routines)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Initialization of variables|How to initialize variables]] &lt;br /&gt;
# [[ReNamer:Pascal Script:Dialogs|How to create interactive dialogs]]&lt;br /&gt;
# [[ReNamer:Pascal Script:FilePath|How to work with folders and paths (FilePath constant)]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Break script execution|How to break the script execution]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Read file content|How to read file content]]&lt;br /&gt;
# [[ReNamer:Pascal Script:Import functions|How to import functions]]&lt;br /&gt;
# [[ReNamer:Pascal Script:SplitPath|How to split file path into parts (folders, base, extension)]]&lt;br /&gt;
&lt;br /&gt;
== Scripts repository  ==&lt;br /&gt;
&lt;br /&gt;
* Official [[ReNamer:Scripts|Scripts Repository]].&lt;br /&gt;
* The [http://www.den4b.com/forum/ Forum] contains several ready scripts.&lt;br /&gt;
&lt;br /&gt;
Study them and adopt them for your purpose.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
A few quick tips: &lt;br /&gt;
&lt;br /&gt;
* In Pascal Script, ReNamer has defined the &#039;&#039;&#039;FileName&#039;&#039;&#039; variable to represent the New Name of the File. &amp;lt;br&amp;gt;Therefore, in your script, you will have to manipulate this variable to change the filename. &lt;br /&gt;
* The &#039;&#039;&#039;FilePath&#039;&#039;&#039; constant holds the original path of the file. It allows you to access the file directly.&amp;lt;br&amp;gt; &lt;br /&gt;
* ReNamer supports UDFs (User-Defined Functions) and also [[ReNamer:Pascal Script:Import functions|importing of external functions from DLLs]].&amp;lt;br&amp;gt;&lt;br /&gt;
* Try to use &#039;&#039;&#039;WideString &#039;&#039;&#039;[[ReNamer:Pascal Script:Types|type]] instead of an ordinary &#039;&#039;&#039;String&#039;&#039;&#039; type. This will allow ReNamer to handle Unicode filenames.&amp;lt;br&amp;gt;(In other words, it will be able to handle non-English scripts, such as Cyrillic, Asian, German, French, etc.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; Do not override ReNamer&#039;s built-in variables, types and functions.&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;&#039;&#039;&#039;Warning:&#039;&#039;&#039; Some of the functions are able to alter your file system (create new folders, move files, etc.). So use them with caution! Remember that scripts are executed during Preview (NOT Rename) operation. So you let the script alter your system by pressing Preview or having Auto Preview on.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; The only product of PascalScript that doesn&#039;t affect your files until Rename operation is the content of the FileName variable. &amp;quot;New Name&amp;quot; (and &amp;quot;New Path&amp;quot;) fields of filetable are replaced with this variable content. After Preview you may check if you like them and if you do - press Rename. Only then the actual renaming of the files will take place.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.remobjects.com/ps RemObjects Pascal Script]&lt;br /&gt;
: Developers of the Pascal Script component.&lt;br /&gt;
* [http://www.delphibasics.co.uk/ Delphi Basics]&lt;br /&gt;
: Help and reference for the fundamentals of the Delphi/Pascal language.&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;br /&gt;
[[Category:Pascal Script]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Quick_Guide&amp;diff=1949</id>
		<title>ReNamer:Quick Guide</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Quick_Guide&amp;diff=1949"/>
		<updated>2010-09-22T19:39:33Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Test adding an ALT text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
Using ReNamer is very simple. Just follow the four steps shown below. &lt;br /&gt;
&lt;br /&gt;
[[Image:ReNamer Main Steps.png]] &lt;br /&gt;
&lt;br /&gt;
Test 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;imagemap&amp;gt; &lt;br /&gt;
Image:ReNamer Main Steps.png| &lt;br /&gt;
rect 76 58 253 82 [[Adding files and folders|Adding files and folders]] &lt;br /&gt;
desc none &lt;br /&gt;
&amp;lt;/imagemap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;imagemap&amp;gt;&lt;br /&gt;
Image:ReNamer Main Steps.png||alt=Hoover over this image to spot links to more explanations.&lt;br /&gt;
rect 3 40 255 86 [[Adding files and folders]]&lt;br /&gt;
rect 303 53 393 135 [[Previewing files|See HowTo Previewing files]]&lt;br /&gt;
rect 465 55 545 135 [[Renaming files|I use just IrfanView (or such) to make an selection to get the rectangle coordinates]]&lt;br /&gt;
rect 3 83 295 129 [[Managing rules|See the full power of ReNamer: This section explains how to add rules, remove rules, edit a rule andchange the order in which they are applied to files and folders.]]&lt;br /&gt;
desc none&lt;br /&gt;
&amp;lt;/imagemap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step &lt;br /&gt;
! What to do&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(255, 0, 0); font-size: 1.8em;&amp;quot; | 1&lt;br /&gt;
| Select the files from various folders and add them to the working area. &lt;br /&gt;
&lt;br /&gt;
a. Change default behavior for the &#039;&#039;&#039;Add Folders&#039;&#039;&#039; button (optional step) &lt;br /&gt;
&lt;br /&gt;
b. Add individually selected files (&#039;&#039;&#039;Add Files&#039;&#039;&#039;) and/or all files in selected folders (&#039;&#039;&#039;Add Folders&#039;&#039;&#039;), and/or... &lt;br /&gt;
&lt;br /&gt;
c. Drag-n-drop files from Windows Explorer (or any other application) in this area (called &amp;quot;&#039;&#039;&#039;Files&#039;&#039;&#039; pane&amp;quot;). &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(210, 105, 30); font-size: 1.8em;&amp;quot; | 2&lt;br /&gt;
| Add rules to create a sequence. Delete or edit an existing rule. Change the order of the rules.&lt;br /&gt;
&lt;br /&gt;
a. Allows addition and deletion of rules. Also change the order of any rule in the stack. &lt;br /&gt;
&lt;br /&gt;
b. Click in this area to add a rule (or to edit an existing rule, or just move it to a new position in the list) &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(65, 105, 225); font-size: 1.8em;&amp;quot; | 3&lt;br /&gt;
| Preview the results (check before proceeding with the actual renaming) &lt;br /&gt;
&lt;br /&gt;
a. Set options (e.g. highlight changed names, experiment with your own text, resolve conflicts, etc.) &lt;br /&gt;
&lt;br /&gt;
b. Click to see preview the new file names in the bottom pane (not required in &#039;&#039;&#039;&#039;&#039;auto-preview&#039;&#039;&#039;&#039;&#039; mode) &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(60, 179, 113); font-size: 1.8em&amp;quot; | 4&lt;br /&gt;
| Press this button to rename files and folders.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ReNamer is so intuitive that you would be able to use it without reading the manual any further. &lt;br /&gt;
&lt;br /&gt;
The rest of the chapters provide more details on all aspects of ReNamer. Use them as reference. &lt;br /&gt;
&lt;br /&gt;
There is an older version of this guide available here: [[ReNamer:Quick Start]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
	<entry>
		<id>https://www.den4b.com/w/index.php?title=ReNamer:Quick_Guide&amp;diff=1948</id>
		<title>ReNamer:Quick Guide</title>
		<link rel="alternate" type="text/html" href="https://www.den4b.com/w/index.php?title=ReNamer:Quick_Guide&amp;diff=1948"/>
		<updated>2010-09-22T19:24:45Z</updated>

		<summary type="html">&lt;p&gt;Stefan: Some tests with ImageMap syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Up|ReNamer}}&lt;br /&gt;
&lt;br /&gt;
Using ReNamer is very simple. Just follow the four steps shown below. &lt;br /&gt;
&lt;br /&gt;
[[Image:ReNamer Main Steps.png]] &lt;br /&gt;
&lt;br /&gt;
Test 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;imagemap&amp;gt; &lt;br /&gt;
Image:ReNamer Main Steps.png| &lt;br /&gt;
rect 76 58 253 82 [[Adding files and folders|Adding files and folders]] &lt;br /&gt;
desc none &lt;br /&gt;
&amp;lt;/imagemap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test 2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;imagemap&amp;gt;&lt;br /&gt;
Image:ReNamer Main Steps.png|&lt;br /&gt;
rect 76 55 253 85 [[Adding files and folders]]&lt;br /&gt;
rect 303 53 393 135 [[Previewing files|See HowTo Previewing files]]&lt;br /&gt;
rect 465 55 545 135 [[Renaming files|I use just IrfanView (or such) to make an selection to get the rectangle coordinates]]&lt;br /&gt;
rect 3 83 295 129 [[Managing rules|See the full power of ReNamer: This section explains how to add rules, remove rules, edit a rule andchange the order in which they are applied to files and folders.]]&lt;br /&gt;
desc none&lt;br /&gt;
&amp;lt;/imagemap&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step &lt;br /&gt;
! What to do&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(255, 0, 0); font-size: 1.8em;&amp;quot; | 1&lt;br /&gt;
| Select the files from various folders and add them to the working area. &lt;br /&gt;
&lt;br /&gt;
a. Change default behavior for the &#039;&#039;&#039;Add Folders&#039;&#039;&#039; button (optional step) &lt;br /&gt;
&lt;br /&gt;
b. Add individually selected files (&#039;&#039;&#039;Add Files&#039;&#039;&#039;) and/or all files in selected folders (&#039;&#039;&#039;Add Folders&#039;&#039;&#039;), and/or... &lt;br /&gt;
&lt;br /&gt;
c. Drag-n-drop files from Windows Explorer (or any other application) in this area (called &amp;quot;&#039;&#039;&#039;Files&#039;&#039;&#039; pane&amp;quot;). &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(210, 105, 30); font-size: 1.8em;&amp;quot; | 2&lt;br /&gt;
| Add rules to create a sequence. Delete or edit an existing rule. Change the order of the rules.&lt;br /&gt;
&lt;br /&gt;
a. Allows addition and deletion of rules. Also change the order of any rule in the stack. &lt;br /&gt;
&lt;br /&gt;
b. Click in this area to add a rule (or to edit an existing rule, or just move it to a new position in the list) &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(65, 105, 225); font-size: 1.8em;&amp;quot; | 3&lt;br /&gt;
| Preview the results (check before proceeding with the actual renaming) &lt;br /&gt;
&lt;br /&gt;
a. Set options (e.g. highlight changed names, experiment with your own text, resolve conflicts, etc.) &lt;br /&gt;
&lt;br /&gt;
b. Click to see preview the new file names in the bottom pane (not required in &#039;&#039;&#039;&#039;&#039;auto-preview&#039;&#039;&#039;&#039;&#039; mode) &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;background-color: rgb(60, 179, 113); font-size: 1.8em&amp;quot; | 4&lt;br /&gt;
| Press this button to rename files and folders.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
ReNamer is so intuitive that you would be able to use it without reading the manual any further. &lt;br /&gt;
&lt;br /&gt;
The rest of the chapters provide more details on all aspects of ReNamer. Use them as reference. &lt;br /&gt;
&lt;br /&gt;
There is an older version of this guide available here: [[ReNamer:Quick Start]]&lt;br /&gt;
&lt;br /&gt;
[[Category:ReNamer]]&lt;/div&gt;</summary>
		<author><name>Stefan</name></author>
	</entry>
</feed>