We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

Getting and analysing file names

Anonymous
Not applicable
Hi,

Is it possible to get file names from within a user-chosen folder and analyse them? I want to be able to automatically create a new file name based on what files already exist within the folder I'm saving to. At a very basic level this would be to increase a number on the end of the file name based on whether there are already files of the same name in the folder.

Thanks
2 REPLIES 2
Anonymous
Not applicable
rCushing wrote:
Hi,

Is it possible to get file names from within a user-chosen folder and analyse them?
Thanks
Sure, you can get paths/names of all files and folder at the provided location with IO library (Input Output). You can also use std library for it.
When you have it rest is string manipulation and passing modified name to save function.
Ralph Wessel
Mentor
You could use IO::TreeEnumerator to get all the files in a specified directory (and optionally subdirectories). There's an example if this in use in the DG_Test project with the dev-kit (see the class FolderEnumerator).
Ralph Wessel BArch
Software Engineer Speckle Systems