In cases you want to write to a file which you do not want to override if existing. This helper function checks if a file exists, if it does it just appends an integer to the filename Source originally by user spacedman on stackoverflow.
Arguments
- path
Character containing the path with fileextensions
- n_digits
(Optional) Integer, number of leadings 0 before the filename. Default is n_digits = 3
- maxruns
(Optional) Integer, Default is maxruns = 500.
- ...
(Optional) Additional Parameters, not utiliezd in this function, enables passing from passing of previous functions