Skip to content

Instantly share code, notes, and snippets.

@coderek
Created August 6, 2018 16:15
Show Gist options
  • Save coderek/2f194c63ab06a8760b2473ab0d30f2b3 to your computer and use it in GitHub Desktop.
Save coderek/2f194c63ab06a8760b2473ab0d30f2b3 to your computer and use it in GitHub Desktop.
from subprocess import run, DEVNULL
import re
cp = run(['ls', 'graphql'], stdout=PIPE, encoding='utf-8')
for filename in re.split(r'\s+', cp.stdout):
if filename:
cp = run(
'ack -w -r {filename} **/**'.format(filename=filename),
stdout=DEVNULL,
shell=True)
if cp.returncode == 1:
run(['rm', 'graphql/' + filename])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment