Skip to content

Instantly share code, notes, and snippets.

@jkbrzt
Last active June 6, 2023 14:59
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jkbrzt/7892597 to your computer and use it in GitHub Desktop.
Save jkbrzt/7892597 to your computer and use it in GitHub Desktop.
Delete Python's compiled *.pyc files like a pro
#!/bin/sh
#
# Delete Python's compiled *.pyc and __pycache__ files like a pro
# https://gist.github.com/jakubroztocil/7892597
#
# Usage:
# Delele *.pyc and __pycache__ files recursively in the current directory:
# $ pyc
#
# The same, but under /path:
# $ pyc /path
#
if [ "$1" ]; then
WHERE="$1"
else
WHERE="$PWD"
fi
find "$WHERE" \
-name '__pycache__' -delete -print \
-o \
-name '*.pyc' -delete -print
(httpie)~/Code/httpie $ pyc
/Users/jakub/Code/httpie/httpie/__init__.pyc
/Users/jakub/Code/httpie/httpie/__main__.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/__init__.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/__main__.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/cli.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/client.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/compat.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/config.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/context.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/core.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/downloads.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/input.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/models.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/sessions.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__/utils.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/__pycache__
/Users/jakub/Code/httpie/httpie/cli.pyc
/Users/jakub/Code/httpie/httpie/client.pyc
/Users/jakub/Code/httpie/httpie/compat.pyc
/Users/jakub/Code/httpie/httpie/config.pyc
/Users/jakub/Code/httpie/httpie/context.pyc
/Users/jakub/Code/httpie/httpie/core.pyc
/Users/jakub/Code/httpie/httpie/downloads.pyc
/Users/jakub/Code/httpie/httpie/input.pyc
/Users/jakub/Code/httpie/httpie/models.pyc
/Users/jakub/Code/httpie/httpie/output/__init__.pyc
/Users/jakub/Code/httpie/httpie/output/__pycache__/__init__.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/__pycache__/processing.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/__pycache__/streams.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/__pycache__
/Users/jakub/Code/httpie/httpie/output/formatters/__init__.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__/__init__.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__/colors.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__/headers.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__/json.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__/xml.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/__pycache__
/Users/jakub/Code/httpie/httpie/output/formatters/colors.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/headers.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/json.pyc
/Users/jakub/Code/httpie/httpie/output/formatters/xml.pyc
/Users/jakub/Code/httpie/httpie/output/processing.pyc
/Users/jakub/Code/httpie/httpie/output/streams.pyc
/Users/jakub/Code/httpie/httpie/plugins/__init__.pyc
/Users/jakub/Code/httpie/httpie/plugins/__pycache__/__init__.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/plugins/__pycache__/base.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/plugins/__pycache__/builtin.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/plugins/__pycache__/manager.cpython-34.pyc
/Users/jakub/Code/httpie/httpie/plugins/__pycache__
/Users/jakub/Code/httpie/httpie/plugins/base.pyc
/Users/jakub/Code/httpie/httpie/plugins/builtin.pyc
/Users/jakub/Code/httpie/httpie/plugins/manager.pyc
/Users/jakub/Code/httpie/httpie/sessions.pyc
/Users/jakub/Code/httpie/httpie/utils.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/__init__.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/_argcomplete.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/__init__.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/newinterpret.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/oldinterpret.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/reinterpret.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/rewrite.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/assertion/util.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/capture.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/config.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/core.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/doctest.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/genscript.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/helpconfig.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/hookspec.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/junitxml.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/main.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/mark.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/monkeypatch.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/nose.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/pastebin.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/pdb.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/pytester.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/python.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/recwarn.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/resultlog.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/runner.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/skipping.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/standalonetemplate.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/terminal.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/tmpdir.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/_pytest/unittest.pyc
/Users/jakub/Code/httpie/pytest-2.5.2-py2.7.egg/pytest.pyc
/Users/jakub/Code/httpie/pytest_httpbin-0.0.1-py2.7.egg/pytest_httpbin/__init__.pyc
/Users/jakub/Code/httpie/pytest_httpbin-0.0.1-py2.7.egg/pytest_httpbin/certs.pyc
/Users/jakub/Code/httpie/pytest_httpbin-0.0.1-py2.7.egg/pytest_httpbin/plugin.pyc
/Users/jakub/Code/httpie/pytest_httpbin-0.0.1-py2.7.egg/pytest_httpbin/serve.pyc
/Users/jakub/Code/httpie/tests/__pycache__/fixtures.cpython-34.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_auth.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_auth.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_binary.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_binary.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_cli.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_cli.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_defaults.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_defaults.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_docs.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_docs.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_downloads.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_downloads.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_exit_status.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_exit_status.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_httpie.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_httpie.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_output.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_output.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_regressions.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_regressions.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_sessions.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_sessions.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_stream.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_stream.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_unicode.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_unicode.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_uploads.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_uploads.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_windows.cpython-27-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/test_windows.cpython-34-PYTEST.pyc
/Users/jakub/Code/httpie/tests/__pycache__/utils.cpython-34.pyc
/Users/jakub/Code/httpie/tests/__pycache__
/Users/jakub/Code/httpie/tests/fixtures.pyc
/Users/jakub/Code/httpie/tests/utils.pyc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment