Folder creation or Rename History

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
salteran
Posts: 5
Joined: 03 Jan 2026 00:22

Folder creation or Rename History

Post by salteran »

Hi

I am new to XYplorer so please excuse my ignorance if this is a thing. But I have searched an can not find anything on it

I have used another manager Salamander for years but it has not been in development for a long time and I am starting to have issues with it. So I looked for a replacement and found XYplorer which is awesome.

There is one thing in Salamander I liked. That was a history of Folder names when creating or renaming folders. you could up or down arrow when creating a folder or renaming and cycle through the last 10-20 folder names you had used.

I found this convenient when you were duplicating file structures and saved you having to retype the folder name

Is there such a thing in XYplorer?

Could you let me know

Thanks for any assistance

Alan

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder creation or Rename History

Post by admin »

Hi and welcome to the club!

You mean you could press up/down right in the inline rename box (F2) and cycle through recently used folder names? Sounds nice, but it's not currently available in XYplorer.

Without an interface hint, I think most users will never find this function. Is it popular among Salamander users?

highend
Posts: 14923
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder creation or Rename History

Post by highend »

Can be easily done via scripting...

Create user defined commands, assign keyboard shortcuts to them and use the appropriate script
These two variables should be set to the same values in both scripts!

Code: Select all

    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";
Do not set the $maxEntries variable too high, the drop-down for the selection should fit on the screen...

This will create a new folder in the current path

Code: Select all

    // Create folder (with history)
    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";
    $defaultName = "New Folder";

    if (!exists($historyFile)) { new($historyFile, "file"); }
    $historyItems = readfile($historyFile, "t_BLU8", 3:=65001);

    $folderName   = input("Enter folder name", 2:=$defaultName, 7:=$historyItems);
    $escaped      = regexreplace($folderName, "([\\^$.+()\[{])", "\$1");
    $historyItems = regexreplace($historyItems, "^" . $escaped . "(\r?\n|$)");
    $historyItems = $folderName . <crlf> . $historyItems;
    $historyItems = gettoken($historyItems, $maxEntries, <crlf>, , 1);
    writefile($historyFile, $historyItems, , "utf8");
    new($folderName, "dir");
This will rename the currently selected file / folder

Code: Select all

    // Rename file/folder (folders with history)
    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";

    if (!exists($historyFile)) { new($historyFile, "file"); }
    $historyItems = readfile($historyFile, "t_BLU8", 3:=65001);

    $itemPath = <curitem>;
    $itemName = <curname>;

    if (exists($itemPath) == 1) {
        $newItemName = input("Enter new file name",   2:=$itemName);
        if ($newItemName != $itemName) { renameitem($newItemName, $itemPath); }
    } else {
        $newItemName = input("Enter new folder name", 2:=$itemName, 7:=$historyItems);
        if ($newItemName != $itemName) {
            $escaped      = regexreplace($newItemName, "([\\^$.+()\[{])", "\$1");
            $historyItems = regexreplace($historyItems, "^" . $escaped . "(\r?\n|$)");
            $historyItems = $newItemName . <crlf> . $historyItems;
            $historyItems = gettoken($historyItems, $maxEntries, <crlf>, , 1);
            writefile($historyFile, $historyItems, , "utf8");
            renameitem($newItemName, $itemPath);
        }
    }
One of my scripts helped you out? Please donate via Paypal

salteran
Posts: 5
Joined: 03 Jan 2026 00:22

Re: Folder creation or Rename History

Post by salteran »

admin wrote: 03 Jan 2026 10:19 Hi and welcome to the club!

You mean you could press up/down right in the inline rename box (F2) and cycle through recently used folder names? Sounds nice, but it's not currently available in XYplorer.

Without an interface hint, I think most users will never find this function. Is it popular among Salamander users?
Thank you kindly. Yes that is exactly it. Or if you were doing a new folder F7. This was great if you are doing multiple folders of the same kind ie Cover Art, MP3, FLAC, Featurettes etc. Just hit F7, up arrow until you have the one you want or click on on the arrow to the right and select from the list or if you had a folder to rename just F2

I have used it for years. Never really had any contact with other Salamander users but the feture was always there!!!

Alan

admin
Site Admin
Posts: 66075
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder creation or Rename History

Post by admin »

I see. I'll consider it.

Note that you can emulate it to some degree using the Batch Rename dialog. To rename a single item, select it and press Shift+F2. Whatever you enter there will be found in the dropdown list the next time you open the dialog.

salteran
Posts: 5
Joined: 03 Jan 2026 00:22

Re: Folder creation or Rename History

Post by salteran »

highend wrote: 03 Jan 2026 11:08 Can be easily done via scripting...

Create user defined commands, assign keyboard shortcuts to them and use the appropriate script
These two variables should be set to the same values in both scripts!

Code: Select all

    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";
Do not set the $maxEntries variable too high, the drop-down for the selection should fit on the screen...

This will create a new folder in the current path

Code: Select all

    // Create folder (with history)
    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";
    $defaultName = "New Folder";

    if (!exists($historyFile)) { new($historyFile, "file"); }
    $historyItems = readfile($historyFile, "t_BLU8", 3:=65001);

    $folderName   = input("Enter folder name", 2:=$defaultName, 7:=$historyItems);
    $escaped      = regexreplace($folderName, "([\\^$.+()\[{])", "\$1");
    $historyItems = regexreplace($historyItems, "^" . $escaped . "(\r?\n|$)");
    $historyItems = $folderName . <crlf> . $historyItems;
    $historyItems = gettoken($historyItems, $maxEntries, <crlf>, , 1);
    writefile($historyFile, $historyItems, , "utf8");
    new($folderName, "dir");
This will rename the currently selected file / folder

Code: Select all

    // Rename file/folder (folders with history)
    $maxEntries  = 30;
    $historyFile = "<xydata>\History\folders.txt";

    if (!exists($historyFile)) { new($historyFile, "file"); }
    $historyItems = readfile($historyFile, "t_BLU8", 3:=65001);

    $itemPath = <curitem>;
    $itemName = <curname>;

    if (exists($itemPath) == 1) {
        $newItemName = input("Enter new file name",   2:=$itemName);
        if ($newItemName != $itemName) { renameitem($newItemName, $itemPath); }
    } else {
        $newItemName = input("Enter new folder name", 2:=$itemName, 7:=$historyItems);
        if ($newItemName != $itemName) {
            $escaped      = regexreplace($newItemName, "([\\^$.+()\[{])", "\$1");
            $historyItems = regexreplace($historyItems, "^" . $escaped . "(\r?\n|$)");
            $historyItems = $newItemName . <crlf> . $historyItems;
            $historyItems = gettoken($historyItems, $maxEntries, <crlf>, , 1);
            writefile($historyFile, $historyItems, , "utf8");
            renameitem($newItemName, $itemPath);
        }
    }
Thank you HighEnd!!!

These are pretty much what I want.

I had an error with the new folder script initially saying it was empty, but I continued the script and entered a folder name, and now that there is an entry in the history its fine

Also you get a nasty looking error if you try to rename to a folder that already exists, This does not happen with the new folder creation it appends -01 onto the name

Is there away to reassign Hard shortcuts. I would love to make the F2 be mapped to the rename script

At the moment I have assigned New Folder to N and Rename Folder to R and the CTRL + N to the New Folder script

A Big thank you for the assist. I am so Happy!!!!

Thanks

Alan

salteran
Posts: 5
Joined: 03 Jan 2026 00:22

Re: Folder creation or Rename History

Post by salteran »

admin wrote: 03 Jan 2026 11:57 I see. I'll consider it.

Note that you can emulate it to some degree using the Batch Rename dialog. To rename a single item, select it and press Shift+F2. Whatever you enter there will be found in the dropdown list the next time you open the dialog.

Yes I tried that it does work for Batch Rename - Thank you for your help!!!!

highend
Posts: 14923
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder creation or Rename History

Post by highend »

I had an error with the new folder script initially saying it was empty, but I continued the script and entered a folder name, and now that there is an entry in the history its fine
I don't see any sort of errors here...
Also you get a nasty looking error if you try to rename to a folder that already exists, This does not happen with the new folder creation it appends -01 onto the name
Not here
If I create "New folder" with the script and afterwards again (via the script) with the same name then the new created folder gets the -01 suffix automatically...

Remove the original shortcut in Menu - Tools - Customize Keyboard Shortcuts...
and then you can use it for the user defined command
One of my scripts helped you out? Please donate via Paypal

salteran
Posts: 5
Joined: 03 Jan 2026 00:22

Re: Folder creation or Rename History

Post by salteran »

highend wrote: 03 Jan 2026 12:27
I had an error with the new folder script initially saying it was empty, but I continued the script and entered a folder name, and now that there is an entry in the history its fine
I don't see any sort of errors here...
Also you get a nasty looking error if you try to rename to a folder that already exists, This does not happen with the new folder creation it appends -01 onto the name
Not here
If I create "New folder" with the script and afterwards again (via the script) with the same name then the new created folder gets the -01 suffix automatically...

Remove the original shortcut in Menu - Tools - Customize Keyboard Shortcuts...
and then you can use it for the user defined command
Brilliant - Thank you!!!

Post Reply