Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 More File renaming possibilities for c++
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Harald Krause
New Member

Austria
5 Posts

Posted - Feb 19 2019 :  08:01:02 AM  Show Profile  Reply with Quote
I would like to have rename folders (on the harddrive) and multi file renaming tool, like the Search And Replace function. So that I can rename all "XXXbla.cpp" into "YYYYbla.cpp" in a solution.

ChrisG
Whole Tomato Software

USA
146 Posts

Posted - Feb 19 2019 :  11:54:54 AM  Show Profile  Reply with Quote
Some simple renames such as a search and replace could have a simple and intuitive UI, but more complex renames would be difficult to describe without some form of scripting or a large number of UI elements.

Do you think replace X string with Y string in selected files would be sufficient for your use case?

Renaming folders might be more complicated, relative includes may need to be updated, include directories, and any projects containing the files would need to new locations. Could you describe your use case?
Go to Top of Page

Harald Krause
New Member

Austria
5 Posts

Posted - Feb 19 2019 :  12:05:47 PM  Show Profile  Reply with Quote
About the Filename renaming:
Have a look how Total Commander (https://www.ghisler.com/) does it, there is a "Multi File Rename tool"
There you have a few but very powerful options how to rename a batch of files. Something like this would be perfect.

About Moving folders.
"...relative includes may need to be updated, include directories, and any projects containing the files would need to new locations."

Exactly. I have several multi thousand file projects and now I need to move hundreds files around because their current folder does not reflect their actual use or purpose anymore, move files from one folder to the other to get them better organised and logically connected and get all the #includes everywhere updated.
Go to Top of Page

Harald Krause
New Member

Austria
5 Posts

Posted - Feb 19 2019 :  12:08:15 PM  Show Profile  Reply with Quote
Here is a screenshot of the Total Commander Multi Rename Tool to see what it can do:
https://www.ghisler.com/screenshots/en/06.html
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Feb 19 2019 :  2:22:12 PM  Show Profile  Reply with Quote
Just starting with the folders, they are not directly "visible" in the IDE. They show up in the file paths, but are not obviously shown in the IDE.

When you are renaming folders, are you just trying to rename the folders, or actually move the files from one folder to another? If you are "just" looking to rename the folders without changing the folder layout, you could try doing a search and replace in your VCXPROJ files, to update any directory include's that reference the old directory name.

How many files are you looking to update? A handful? 100's? Millions? I am trying to get a sense of the scale of what you are after doing here.

I have seen a few renaming tools, but they are just concerned with renaming the files directly on the hard drive, which is a simpler operation.

zen is the art of being at one with the two'ness
Go to Top of Page

Harald Krause
New Member

Austria
5 Posts

Posted - Feb 19 2019 :  3:33:47 PM  Show Profile  Reply with Quote
I want to do a lot of different things:
Create folders and move files into them
Move files to different folders
Rename Folders
Move whole folders into other folders.

Its just the necessary "cleanup" which should be done from time to time. I guess per it will be several dozens up to a few hundred such operations listed above per multi thousand files solution.
Right now we are "afraid" to do it because there will be lots of breaking the source code and make it not compile able even when we write a lot of scripts who do most of the work by updating all the #includes etc. So I think that this would be a useful function in a tool like Visual Assist.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Feb 20 2019 :  06:53:50 AM  Show Profile  Reply with Quote
This makes sense, and I can see how and why putting this into VA makes sense. I want to think this through a little bit before putting in a feature request, to make sure I have a reasonable handle on what we are looking for here.

Creating a folder we can probably ignore, since until you move a file into it, we don't care.

Moving a folder and renaming a folder, once you get to updating the IDE, are almost the same operation. In both cases you need to search for:
1) all include directories, across all projects, that need to be updated
2) all relative or absolute include statements inside code files that need to be updated, so all #include "..\oldName\usefulFile.h" lines

I am trying to work out what the edge cases are going to be, where this will break down and not work.

I think the main concerns are any include directory settings that VA does not know about, but we can mostly ignore this I think. The other edge case is where it is not clear if the code should be updated.

It is quite possible to have situations where a #include statement could resolve to two (or more) different header files. At compile time this will be worked out, but VA does not always have all of the information in hand, so cannot always resolve these situations. So we would need to list / prompt and ask about, any situations that are not clear.

Does this sound like it will cover what you need here, and watch out for the problems you are seeing?

zen is the art of being at one with the two'ness
Go to Top of Page

Harald Krause
New Member

Austria
5 Posts

Posted - Feb 20 2019 :  09:59:52 AM  Show Profile  Reply with Quote
Yes this looks good. And have a look at the Multi Rename Tool from Total Commander. Especially the Search And Replace and the [N##][E] functions they have for renaming files. Its really thought through and would be a perfect tool for massive code refactoring operations.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Feb 20 2019 :  2:07:47 PM  Show Profile  Reply with Quote
Looks like we have a sensible outline plan for renaming directories / moving files from one directory to another. Thinking about this, creating a directory can be done "inline" while specifying the new target directory for moving files. I have put in a feature request for this idea:

case=137038

The idea of moving files came up once or twice before, so there is already a case for this:

case=69734

There does not seem to be a lot of obvious online documentation for the Total Commander file renaming system. Regular expressions are probably the easiest flexible system for mass renaming, since this will make it easy to specify how many characters to capture keep or capture remove. I have put in a feature request for this as well:

case=137039

Please be aware all of this is likely to take some time, if it is ever done at all, since these are not going to be small and fast changes to VA.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000