Package com.zaranux.os.client.commands

Source Code of com.zaranux.os.client.commands.rm

/**
*
*/
package com.zaranux.os.client.commands;

import com.zaranux.client.api.AsyncCallback;
import com.zaranux.client.java.io.File;


public class rm extends Command {

  @Override
  protected void execute(final AsyncCallback<Boolean> callback) {
    String[] args = getArgs();

    final String fileName = getAbsolutePath( args[0] );
   
    File f = new File(fileName + "/file" );
    f.delete(new AsyncCallback<Boolean>() {

      public void onFailure(Throwable caught) {
       
        System.out.print("Failed to delete " + fileName,callback);
       
      }

      public void onSuccess(Boolean result) {
       
        if (result) // if result is true, file is deleted
        {
          System.out.print( fileName + " is deleted.", callback );
        } else {
          System.out.print( "Failed to delete " + fileName, callback );
        }
       
      }

    });
   

  }

}
TOP

Related Classes of com.zaranux.os.client.commands.rm

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.