Performing the same operation on a set of snapshots with ``snapshots_exec`` *************************************************************************** Very often, it is useful to perform the same operation on a set of similar files, for example, the output snapshots of a simulation. **pNbody** offers a command to do so:: snapshots_exe Just provide a set of files as well as a command to execute on the ``nb`` object, and it will to it:: snapshots_exec snapshots/* --exec "print(nb.nbody)" This command is very useful to extract particles for a set of snapshots and store the sub-snapshots in a dedicated directory:: snapshots_exec snapshots/* --exec="nb = nb.select('stars')" -o snap Scripts ------- ``snapshots_exec`` .................. .. program-output:: snapshots_exec -h