Script to rename/copy a project


#1

If anyone is interested in some Python, I done a script :slight_smile: This is in response to How to up issue a board

It has a number of options, but in the sample case to copy a project to a different folder while renaming the project:

python rename_project.py -d ver1 -t _v1

copy without rename

python rename_project.py -d ver1

or if you just want to rename in place:

python rename_project.py  -n new_name

To create a sub-folder with a date stamp e.g. ./2017-05-04_12-10-14/

python rename_project.py

To do a “dry-run”, the -x option should be used. This shows what would be done.

It doesn’t copy sub-folders, gerbers or kicad_mod files. It is only lightly tested, and very much a beta version, so make sure you back up files before running it (I know that slightly defeats the purpose, but there are probably bugs). It doesn’t prevent overwriting the destination folder.

rename_project.py (8.5 KB)

Now on github https://github.com/bobc/KiRename. I’ll look at creating an installable version.


#2

nice idea…
would you mind to have it working also for project with hierarchical sheets?


#3

I don’t think I would mind, although I’m not exactly sure what changes are required…


#4

if you have a main_sheet.sch with i.e. some subsheet named sub_sheet1.sch and sub_sheet2.sch, the script should rename i.e. main_sheet.sch to main_sheet_v1.sch, the two sub sheet to sub_sheet1_v1.sch and sub_sheet2_v1.sch and inside the main_sheet.sch rename the two subsheet accordingly… this last part is missing atm…


How to rename a project?
#5

Yes, I think that is doable, I will work on it.


#6

Thanks for this, Bob, I will give it a try! :slight_smile: Am a big fan of Python (even if no expert!).


#7

Thank you for working on this. I was unpleasantly surprised when I found there was no way to change the name of a project or even save it under a different name.
Please continue work on this. I would gladly donate to your efforts for a working, installable version.

Best Regards


#8

Hi,
After just a few minutes Googling Python I was able to use this script to rename my test project to a meaningful name.

THANKS!

(Although I think I could have done the same thing by individually renaming the files?)

If this is made into an install-able add on it would be very nice :slight_smile: