How to make Runtime.exec call Linux exec?

Howdy,
I am trying to use a combination of 'find' and 'rm' to delete all files with a certain extension in a directory and all of its subdirs.
Here's the command:
Process proc = runtime.exec("find " + dir + " -name '*.vcs' -exec rm -rf {} \\;");
It's failing, not sure why, the exitCode is 1 instead of 0. I'm not sure if it's because I have to escape the '\' character, or if it's because I am calling Linux's 'exec' function within a Java exec() call, or something else entirely.
The easiest thing to do would be to just use rm, but that doesn't seem to be an option. With rm it seems to be all or nothing -- If I try:
rm -rf *.vcs
it fails if it doesn't find a file with that extension in the start directory (even though I've specified -r). But if I enter:
rm -rf *
it nukes my directories AND files, something I don't want to happen. I realize this is a Linux thing, I'm just explaining it here as background, just in case.
Anyway, so is there a way to do this? Perhaps with another system call, without using Linux's exec()?
Many thanks
Bob

import java.io.*;
public class ExecutingALinuxCommand
    static class PipeInputStreamToOutputStream implements Runnable
        PipeInputStreamToOutputStream(InputStream is, OutputStream os)
            is_ = is;
            os_ = os;
        public void run()
            try
                byte[] buffer = new byte[1024];
                for(int count = 0; (count = is_.read(buffer)) >= 0;)
                    os_.write(buffer, 0, count);
            catch (IOException e)
                e.printStackTrace();
        private final InputStream is_;
        private final OutputStream os_;
    public static void main(String[] args)
        try
            String dir = System.getProperty("user.home") + "/work/dev";
            String[] command = {"sh","-c", "find " + dir + " -name '*.java' -exec grep -l Runtime {} \\;"};
            final Process process = Runtime.getRuntime().exec(command);
            new Thread(new PipeInputStreamToOutputStream(process.getInputStream(), System.out)).start();
            new Thread(new PipeInputStreamToOutputStream(process.getErrorStream(), System.err)).start();
            int returnCode = process.waitFor();
            System.out.println("Return code = " + returnCode);
        catch (Exception e)
            e.printStackTrace();
}

Similar Messages

  • How to make a vedio call in windows mobile

    sir iam using htc touch pro2 t7373 rhod100 i am use skype but i cant make vedio call how to make a vedio call in this mobile 

    Hi,
    see: ADF Mobile: Start a phone call from app?
    Frank

  • How to make a conference call from an iPhone

    How to make a conference call from an iPhone

    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf user manual

  • I don´t know how to make a phone call whit my ipad...and how to sent a message? is it possible?

    i don´t know how to make a phone call whit my ipad...and how to senSeleneGMt a message? What do i need? or is it impossible?

    You can't; not natively, anyway, since the iPad is not a phone. If you want to make a call, you'll need to use some third-party Voice-Over-IP service such as Skype.
    I'm not sure what you're asking when you ask about sending a message. If you mean a text message, you can either use iMessage, which can send messages to other users also running iMessage, or you can look in the iTunes Store for SMS apps, a few of which are available. They use separate services to actually send the message and so require an Internet connection, either WiFi or 3G.
    Regards.

  • How to make a sim call in ipad2

    how to make a Sim call

    iPad has no native telephone capability. You will need to use n app like FaceTime
    or Skype utilizing wifi or data to make the call. FaceTime works only to other iOS
    devices or Apple computers running appropriate versions of OS X. Skype and others
    allegedly work independent of the the operating system used by caller and/or callee.

  • Presentation Button:How to make it work in linux?

    Anybody here have any idea how to make the toshiba presentation button work in linux?
    thanks!

    Hi
    Sorry but how you know, Toshiba only supports officially Microsoft operating systems at this time. In this case its difficult to say how to use the dual display because there are not official documents about this theme.
    Please check on the web for some Linux infos.
    i.e. www.distrowatch.com
    Maybe you will be able to find more information about that.
    Bye

  • How to make a SOAP call using the PI 7.1

    Hi All,
    Can you please tell me how can we make a SOAP call using the PI 7.1?
    Thanks in advance

    Hello Shweta,
    Could you please clarify your question? Do you mean you need to call some business system from PI via SOAP? Or do you need to test integration model using SOAP client?
    If the requirement is to make a SOAP call to PI (send SOAP request to PI system), please refer to the guide which Stefan suggested in his post. The general procedure is the following:
    1. generate concrete WSDL in PI (you can do it via PI's Integration Directory);
    2. import generated WSDL to SOAP client (e.g. XML Spy described in the guide or soapUI which is free SOAP client);
    3. create SOAP request message in the SOAP client and send it to the endpoint (in this case, it will be sent to PI).
    This is general procedure for making SOAP calls to SAP PI using external SOAP clients. Please advise if specified steps should be described in more details or if there are any questions from your side regarding them.
    If the question is about calling business system from PI via SOAP, then please refer to SAP Help, configuration of SOAP receiver::
    http://help.sap.com/saphelp_nw04/helpdata/en/29/5bd93f130f9215e10000000a155106/frameset.htm
    My regards,
    Vadim

  • TS4268 How to make cellular video call in iPhone 4S

    How to make video call in my iPhone 4S

    Did you purchase from an authorized source? I ask, because FaceTime is banned in some Middle East countries, and if you purchase from a non-authorized source, odds are you're gonna get an iPhone that originated in a country where FaceTime is banned. I suspect this is the case with your phone.

  • How to make a video call to a person's i phone from face time on an iMac

    I want to use face time to make a video call from my i mac to an i phone.  "help" is not informative.

    The following may help:
    http://www.imore.com/how-make-facetime-call-your-mac
    https://www.apple.com/support/mac-apps/facetime/

  • How to make a phone call

    All I want to do is make a phone call but I do not know how to get to a screen that allows me to make a phone call.  I am not trying to do anything fancy.  I just want to be able to dial a number and click a phone icon, but I am unable to find any way to get to a screen that lets me do it.   I have already bought an unlimited subscription.  It seems impossible to get skype to actually let me make a phone call. There is no screen where the activity being performed is making a phone call. ?????   There is also no instruction about this anywhere in the help menu.  Is this a scam or is it possible to make an actual phone call?

    Have you actually installed Skype program on your computer and are you using this program? http://www.skype.com/en/download-skype/

  • How to make a phone call from my ipad

    hello
    question is can i make a phone call like with an iphone
    ipad2 wifi 3G with expresso network in senegal
    thanks

    It is NOT a phone.
    You would have to use an app as Kirkman14 has explained.

  • How to Make A Video Call (without FaceTime) from iPhone 4?

    I would like to make a video call from my iPhone 4 just like the way all the 3G devices nowadays do (not using the FaceTime, Fring, Tango or Skype).
    I want to make video calls to other smartphones using the below facility provided by my telecom service provider :
    http://www.rcom.co.in/Rcom/personal/3G/HTML/VideoCalling.html
    The above feature charges a nominal amount for the video calls, and does not require any data to make the call, and they are also quite good in quality.
    Also, when my friend calls me using this feature from his Nokia C7, he gets the error "The mobile phone you are trying to make a video call to, does not support it"
    For the record, I'm using iOS 4.2.1.
    Any help would be greatly appreciated.

    After the skype 5 headache which many users are experiencing, I just found "" vtok "" in apples app store.
    It supports VIDEO and CALL over wifi AND 3G !!  It does work fantastic and is FREE.
    BUT you would have to set up a free "Google mail" address to get it to work.
    It's painless and is a great option.
    Amen

  • How to make a video call in iphone 5 over 3g without facetime and skype.

    I can't make video call to other device iver 3g. Now what can i do?

    You cannot make 3G video calls via your wireless carrier on iPhone.
    You can only make Internet Video Calls.
    For some reason Apple Doesn't has that feature.

  • How to Make a Video Call Using iChat to Someone Using MS Live Call

    What do I need to do to make/receive video calls using iChat to someone who uses Microsoft Live Call (using Windows Live Messenger to register me as a contact)?
    When I initially set up iChat, I selected AIM (AOL Instant Messenging) as my default messenger program. But I can't remember where I set that up. Where in iChat can I make that change from AIM to Windows Live Messenger?

    If its anything like MSN you cant video chat with ichat.
    The only way on MSN is.
    aMSN http://www.macupdate.com/info.php/id/14200/amsn
    Mercury http://www.macupdate.com/info.php/id/14970/mercury-messenger
    Or both of you use Skype.
    Mac version http://www.skype.com/intl/en-gb/download/skype/macosx/
    Pc http://www.skype.com/intl/en-gb/download/skype/windows/
    Or web based http://www.mebeam.com/

  • How to make a video call on Z1

    Hello,
    I am unable to find any option to make aa video call in my Z1 while an on other handset like Nokia N8, lenovo P770, Samsung phone there is an option arises to choose for video call to any contact directly and no application is used to make a video call.
    Plz suggest me to make a video call option on 3G network.

    Unfortunately most of the new phones using modern mobile OSes doesn't support 3G Video Call. It's true for Android, iOS and WP.
    I remember times when I was using it on my old Symbian phones and even feature phones but since iOS and Android took over mobile world no one remember that feature anymore.
    Best regards,
    Sergio PL
    Xperia Z1 / Nexus 7 (2012)

Maybe you are looking for