nb-clean
nb-clean copied to clipboard
Support batch and wildcard file names
Support this feature:
nb-clean clean --preserve-cell-outputs notebooks/*
It first will list all .ipynb files in notebooks/, then iteratively clean all the notebooks.
This should already work if globs are expanded by your shell, which they typically are by default in shells like bash and zsh. For example:
$ ls -1 notebooks
dirty-1.ipynb
dirty-2.ipynb
$ nb-clean check notebooks/*
dirty-1.ipynb cell 0: metadata
dirty-1.ipynb cell 0: execution count
dirty-1.ipynb cell 0: outputs
dirty-1.ipynb metadata: language_info.version
dirty-2.ipynb cell 0: metadata
dirty-2.ipynb cell 0: execution count
dirty-2.ipynb cell 0: outputs
dirty-2.ipynb metadata: language_info.version
However, it would be useful to be able to pass a directory name without a glob (e.g. nb-clean clean notebooks) and have nb-clean operate on that recursively: PRs for this would be welcome.
I'm using Windows powershell and the above code is not working (nb-clean clean --preserve-cell-outputs notebooks/*).
@yasirroni This should be resolved by #148, but I haven't been able to test on Windows with PowerShell. If you have problems in that environment, please open a new issue.