Open NightWatch0 opened 1 month ago
This would be great. No clue if it's possible but providing some functionality that parallels the regex replacement rules we already use in PowerRename would also be great.
Obviously a very naive example but something like:
TitleRule = "$FolderName ${start=1,increment=1}"
Where applying the above is decided based on rules like:
If Path Matches Pattern = **\testruns\**
Then $Foldername="testrun[:digit:]"
Then using a NewPlus to apply a folder template in the directory C:\users\User\src\project\testruns\
, the existing contents of which are as follows:
testruns\
|
|__testrun1
|
|__testrun2
would result in a new folder called testrun3
created.
Description of the new feature / enhancement
NewPlus supports using template strings such as yyyyMMdd (represent the current date) in template folder names or file names.
For example, in “%LocalAppData%\Microsoft\PowerToys\NewPlus\Templates” there are the following folders:
When I used the first template on 2024-10-10, it generated:
And when I used the second template inside the "Work" folder, it generated:
In addition, it should be possible to use specific variables to specify the part of the file name that needs to be modified after creating a new file. Usually, after creating a new file, it will switch to the rename file state and select the entire file name in the rename text box, as shown below.
But most of the time, only specific parts need to be modified. For example, creating a template folder with variables above to get "20241010: Title", user only need to change the last word "Title" to the name of a specific item.
So I want to be able to use a tag like # to specify the part of the file name that actually needs to be modified, to change the cursor/selection behavior when automatically renaming after creating the file. The resulting template folder name may look like this:
Scenario when this would be used?
This method can expand the flexibility of the NewPlus module and reduce a large number of renaming operations. It does not introduce too many complex operations, and only requires changing the file name of the template file.
Supporting information
no