Forum

Author Topic: Renaming .psx project and the .files folder  (Read 5399 times)

boulder1998

  • Newbie
  • *
  • Posts: 7
    • View Profile
Renaming .psx project and the .files folder
« on: July 27, 2023, 06:57:51 PM »
Dear all,

Does somebody know how I can edit the file name of the .psx project and the .files folder after running several Metashape functions?

As far as I understand I have to give the project an initial name to even be able to run the Metashape functions and store all the data needed to produce e.g. an orthomosaic.   

Now, my goal is to rename the project and the folder according to what kind of Metashape products I have generated. Meaning, that the final name of the .psx project and the .file folder should tell me if for example I generated an orthomosaic in this specific project or not. For that I have to change the name of both files. Any suggestions?

Thank you for your help.

Cheers, boulder1998

marcel.d

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Renaming .psx project and the .files folder
« Reply #1 on: August 08, 2023, 02:25:12 PM »
Hey, I did not try it myself, but maybe this could work:

Code: [Select]
prom pathlib import Path

# open project and do the processing
doc = Metashape.app.document
doc.open("path/to/initial_name.psx")
# ...

# save to disk
doc.save()

# rename file and folder
Path("path/to/initial_name.psx").rename("path/to/updated_name.psx")
Path("path/to/initial_name.files").rename("path/to/updated_name.files")

# reopen the file and continue processing
doc.open("path/to/updated_name.psx")
# ...

Or maybe even this could work?

Code: [Select]
# open project and do the processing
doc = Metashape.app.document
doc.open("path/to/initial_name.psx")
# ...

# save to disk with new name
doc.save("path/to/updated_name.psx")


Let me know if you try any of the approaches.