topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 19, 2024, 8:27 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Rename FOLDERS in hierarchy  (Read 6656 times)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Rename FOLDERS in hierarchy
« on: February 17, 2023, 12:01 AM »
Given:  Folders and files in some hierarchical structure.

Objective:  Rename the FOLDERS only, not the files.

Rename to XXXXX random digits.  Perhaps the number of random digits can be left to user.  But, let's say, for example, 5 random digits.

So, long folder name:  blah, blah, blah, blah.....

Change to:  39279  (for instance)

Do this for each and every folder in the entire hierarchy, including the base folder.

Program can be used from context menu, or drag-and-drop, or command line, or other.

Why this program??

To deal with long path length issues.  Major headache when, say, unarchived paths exceed 255 characters.  Good grief.  Just horrible.

Idea is to easily deal with extra long paths by changing folder names to short sets of random digits.

Thanks much!

Nicholas Kormanik

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #1 on: February 17, 2023, 09:33 AM »
You want a tool that rename every folder in a base-folder to any random 5 digit number?
like
c:\test\
 \i am a sub-folder\ -> \12345\
 \another sub\ -> \54321\
etc... ?

publicdomain

  • Honorary Member
  • Joined in 2019
  • **
  • Posts: 736
  • Call me Vic!
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #2 on: February 17, 2023, 10:02 AM »
Do this for each and every folder in the entire hierarchy, including the base folder.

Program can be used from context menu, or drag-and-drop, or command line, or other.

Hi Nick! Coding it as a handy Explorer context menu with configurable digits :Thmbsup:

https://github.com/p...ain/rename-hierarchy

Cheers!
My name's Victor but do feel free to call me Vic! (now known as "paradisusvic")

❤️ Support on Patreon @ www.patreon.com/paradisusis
New Email/Paypal: paradisusvicgmail.com

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #3 on: February 17, 2023, 10:59 AM »
Here is my contribution, if I understand the things correct...
Extract archive into any folder.
Run it once with Admin rights (if you are on an Administrator Account it is not needed)
Press [Install]
If you not want it anymore, do same step as above but press [Uninstall] and delete the .exe.

My .exe inside need no runtime files beside a working 64bit Windows OS.

No UI or configurable stuff, it just do what I understand it should do, it rename folders  :D

From now on you have a small Context menu entry called "KZ - Rename Folder Tool"
Executed on any Folder, it will rename all folders inside to 5 digit numbers.

I hope it fit your needs, enjoy  :-*
« Last Edit: February 19, 2023, 07:18 PM by KodeZwerg »

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #4 on: February 17, 2023, 04:18 PM »
As always you folks are amazing.  So glad I asked....

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #5 on: February 17, 2023, 05:41 PM »
I am glad you like, take care, you can not undo (!!)
I did not tested it under all possible conditions (!!)
For now it does work on all folders plus subfolder inside of selected (that folder that you right click on to run my app)
For me its always nice to help and code something quick :P
If you need more abilities, wait that Vic release his version, my is just a working horse without any annoying messages or buttons or whatever 8)
(for slightly changes of how my app works i have an open ear)

publicdomain

  • Honorary Member
  • Joined in 2019
  • **
  • Posts: 736
  • Call me Vic!
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #6 on: February 17, 2023, 06:55 PM »
Here is my contribution [...]

Thanks for your contribution to assist a fellow DC member :Thmbsup:

Custom releases certainly make this community thrive (indeed)

If you need more abilities, wait that Vic release his version [...]

Mine adds two settings:

- Undo (per folder).
- Name length configuration.

There's space for everyone's take :) The more choice for fellow users the merrier!
My name's Victor but do feel free to call me Vic! (now known as "paradisusvic")

❤️ Support on Patreon @ www.patreon.com/paradisusis
New Email/Paypal: paradisusvicgmail.com

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #7 on: February 17, 2023, 09:32 PM »
Here is my contribution [...]
Thanks for your contribution to assist a fellow DC member :Thmbsup:
I do what I can when I got time and topic interest me  ;)

If you need more abilities, wait that Vic release his version [...]

Mine adds two settings:

- Undo (per folder).
- Name length configuration.

There's space for everyone's take :) The more choice for fellow users the merrier!
Sound tasty! ;D
My personal Idea for undo would be something like collecting original names and my random generated, high level compress that data and write it in root folder.
But to be honest, writing data I try to avoid, user should know what he is doing :P
No worries, I will not upgrade my version since from my side the topic is closed to me already  :Thmbsup:

I might upgrade one day to add a UI that user can see progress, for now it is made to be the fastest horse on the derby  :-*

( If interested, my app also rename hidden or superhidden etc... and my random number are limited from 1 to 8, somehow I forgot to add 0 and 9  :) )

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #8 on: February 18, 2023, 08:09 PM »
Victor, looking forward to your solution!

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #9 on: February 19, 2023, 01:54 PM »
Victor, looking forward to your solution!
I am just curious while Vic is busy, ain't my app doing what you wanted it to do?

publicdomain

  • Honorary Member
  • Joined in 2019
  • **
  • Posts: 736
  • Call me Vic!
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #10 on: February 19, 2023, 03:10 PM »
Victor, looking forward to your solution!

Thanks Nick, mine's basically what KZ's coded + an embedded LiteDB database for Undo.

I shall continue using your other opened thread so this one remains devoted to KZ's contribution  :Thmbsup:
My name's Victor but do feel free to call me Vic! (now known as "paradisusvic")

❤️ Support on Patreon @ www.patreon.com/paradisusis
New Email/Paypal: paradisusvicgmail.com

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #11 on: February 19, 2023, 05:05 PM »
Victor, looking forward to your solution!
I am just curious while Vic is busy, ain't my app doing what you wanted it to do?

I tried your program many times on a number of folders.  If simple hierarchy, worked file.  Trouble was, seemed to do nothing on larger folder hierarchies.  Problem could be that the larger folders have path length issues, greater than 255 characters.  Bummer.  If that's the case, probably Victor will run into the same, and come up short.

Long folder/file path problem has plagued me forever.  Wish Windows didn't have the limitation.  What I'm wanting are just the files in the furthest branches.



KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #12 on: February 19, 2023, 07:06 PM »
this one remains devoted to KZ's contribution  :Thmbsup:
:-*
Victor, looking forward to your solution!
I am just curious while Vic is busy, ain't my app doing what you wanted it to do?

I tried your program many times on a number of folders.  If simple hierarchy, worked file.  Trouble was, seemed to do nothing on larger folder hierarchies.  Problem could be that the larger folders have path length issues, greater than 255 characters.  Bummer.  If that's the case, probably Victor will run into the same, and come up short.

Long folder/file path problem has plagued me forever.  Wish Windows didn't have the limitation.  What I'm wanting are just the files in the furthest branches.
Added an updated version that should be able to handle paths up to 32767 character length and if it fail a messagebox pops up.
If you are still having interest in my version, feel free to test and please send me an messagebox image since on my system i do not have such a long structure to test.
Old version was limited to 255 chars, you are correct!
« Last Edit: February 20, 2023, 07:46 PM by KodeZwerg »

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #13 on: February 20, 2023, 07:46 PM »
Fixed logical bug, I apology for that.

*updated
 - added version info (v0.0.0.2)
 - modified final dialog

Snapshot:
Bild_2023-02-21_115141377.pngRename FOLDERS in hierarchy
« Last Edit: February 21, 2023, 05:16 AM by KodeZwerg »

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #14 on: February 21, 2023, 05:25 AM »
v0.0.0.3 released

Introducing now custom length of digits per .ini file
Per default it is set to 5
If you are unhappy with that, open the included .ini file and adjust the number however you like
It is limited to a minimum of 1
[Options]
Digits=5
(If you delete the .ini file, 5 will be always used as default)

To me it is looking final now.
In theory it should be able to handle paths up to 32767 characters but still limited per level to 255 chars (that is Windows limit, not mine)
I hope to hear from you a positive result  :Thmbsup:
« Last Edit: February 25, 2023, 05:28 PM by KodeZwerg »

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #15 on: February 23, 2023, 12:39 AM »
v0.0.0.3 released
I hope to hear from you a positive result.

@KodeZwerg, nailed it.  Works like a charm.  Found that it can be included in the SendTo list, so that one doesn't even have to install it.  And, thus, too, the shortcut to program can be renamed.  "Folders, Rename to Random"

Thanks for working at this!

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #16 on: February 23, 2023, 11:09 AM »
v0.0.0.3 released
I hope to hear from you a positive result.
KodeZwerg, nailed it.
Yay!
Works like a charm.
Thanks for working at this!
I am glad that it finally fit your needs and work as expected!
You are welcome  :-*
Found that it can be included in the SendTo list, so that one doesn't even have to install it.  And, thus, too, the shortcut to program can be renamed.  "Folders, Rename to Random"
About installation, do like you want, feel free to experiment as much as you like.
My app needs as one parameter the target base folder, with one parameter i mean with quotes "c:\this is a folder with spaces"
When you rename my apps exe name, the ini file must also be renamed to work.
So if you call it by a link, my registry setting, your send-to way or plain on a command line, everything is possible  :Thmbsup:

(ps: also fixed in last release is the usage of full 0 -> 9 numbers)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 553
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #17 on: February 23, 2023, 04:49 PM »
@KodeZwerg, if you have a minute more, would you mind telling us how you wrote your program, the computer language?  Just a few hints.

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Rename FOLDERS in hierarchy
« Reply #18 on: February 23, 2023, 05:07 PM »
@KodeZwerg, if you have a minute more, would you mind telling us how you wrote your program, the computer language?  Just a few hints.
The app is compiled with FreePascal, written in Lazarus, but to be honest, I did not used much (beside compiler and Windows SDK) that those ObjectPascal-compatible IDE/Compiler offers.
Everything was written by hand from me by just using the Windows API as reference, thats why my app is (compared to regular 64bit GUI apps) pretty small and if I can say, very fast  :-*

Latest Folder Rename <- press there
« Last Edit: February 25, 2023, 05:51 PM by KodeZwerg »