Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup a bash process for deploying my django project onto a linux server.

Through cygwin, I'm running a script that is calling scp to copy my files over. Is there a similar command to delete *.pyc files. As of now, I've only been able to accomplish this locally after using ssh with:

find . -name "*.pyc" -exec rm -rf {} \;

I'm looking for some kind of command to call remotely that would be equivalent.

share|improve this question
up vote 0 down vote accepted

You can use ssh. The format of ssh is

ssh user@host command

so something like

ssh user@host 'find . -name "*.pyc" -exec rm -rf {} \;'

You should probably use absolute paths for the remote server so you know exactly where you are deleting files. Test it out with

ssh user@host 'find . -name "*.pyc" -print'

share|improve this answer

you can sync your local to remote with rsync over ssh and have the Delete option

share|improve this answer

Your Answer


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.