Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. find . -type f ( -iname '*foo*' ! -name '.*' )
  2.  
  3. import subprocess
  4.  
  5. cmd = ["find", ".", "-type", "f", "(", "-iname", "*foo*", "!", "-name", ".*", ")"]
  6. sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  7. print sp.communicate()[0].split()
  8.  
  9. import subprocess
  10. cmd = 'find . -type f -iname "*foo*" ! -name ".*"'
  11. sp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  12. print sp.communicate()[0].split()
  13.  
  14. cmd = "find . -type f -iname *foo* ! -name .\*"
  15. print(cmd)
  16. ret = subprocess.run(cmd, shell=True, capture_output=True)
  17. print(ret)
  18.  
  19. $ find . -type f -iname *foo* ! -name .*
  20. ./foobar.txt
  21. ./barfoo.txt
  22.  
  23. $ ./findfoo.py
  24. find . -type f -iname *foo* ! -name .*
  25. CompletedProcess(args='find . -type f -iname \*foo\* ! -name .\*',
  26. returncode=0, stdout=b'./foobar.txtn./barfoo.txtn', stderr=b'')
  27.  
  28. cmd = ["find", ".", "-type", "f", "\(", "-iname", "\*foo\*", "!", "-name", ".\*", "\)"]
  29.  
  30. cmd = ["find", ".", "-type", "f", "-iname", "\*foo\*", "!", "-name", ".\*"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement