Skip to content

Simplify the openfoam_remove_empty_dirs.sh script#879

Open
MakisH wants to merge 6 commits into
developfrom
openfoam-remove-empty-dirs
Open

Simplify the openfoam_remove_empty_dirs.sh script#879
MakisH wants to merge 6 commits into
developfrom
openfoam-remove-empty-dirs

Conversation

@MakisH

@MakisH MakisH commented Jul 15, 2026

Copy link
Copy Markdown
Member

The current script is a bit verbose and has some duplication. It also does not handle the case of collated output, as discussed in #834 (comment)

This PR rewrites the script in a more general way. It defines a list of directories to check (. and processor*) and a list of common result files (so this list can also easily be extended in one place), and then:

for each ./ processor*/
  for each numbered directory
    for each expected result
      if a `result` or `result.gz` exists, keep the directory
    if not marked to be kept, delete it

It also improves logging, to make more transparent what is happening. I am not sure if having a list of what was deleted is useful: I already removed this in the past, as the logs were getting too long.

At some point I switched this from standard sh to bash, as our run.sh scripts. Not sure it there is any reason to keep it with sh anymore. At least macOS users have not complained so far.

@mike-tree-corvid what do you think? Does this cover your use case?

Checklist

  • I added a summary of any user-facing changes (compared to the last release) in the changelog-entries/<PRnumber>.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant