Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to execute a complex shell command from inside of python. The naive attempt:

subprocess.call(["find", ".", "-exec touch {} \;"], cwd=".")

is failing. How do I go about doing this?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted
subprocess.call(["find", ".", "-exec", "touch", "{}", ";"])

cwd="." Is not needed as it is the default.

share|improve this answer
    
Defaulting to "." is an extension (I think it is a GNU extension). The standard requires a path in the command line. –  Robᵩ Sep 14 '13 at 0:40
    
@Robᵩ thanks for the update, I hadn't considered that. –  tdelaney Sep 14 '13 at 1:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.