I have a String
that contains the file path, and I need to remove the characters that come after the last "/"
to the end of the string. Can anyone help me with this? ...
Example:
String comando = "C:/Users/Vinicius/Documents/NetBeansProjects/ProjetoORI/retiramarca.exe"
I want to delete "retiramarca.exe"
caminho = pesquisaInfo.getText();
chave = recebeConfirme.getText();
caminhoInvertido = caminho.replace("\", "/");
if (actionCommand.equals("Encrypt File")) {
String comando = "C:/Users/Vinicius/Documents/NetBeansProjects/ProjetoORI/inseremarca.exe " + chave + " " + caminhoInvertido;
try {
System.out.println(caminhoInvertido.getParentFile());
Runtime.getRuntime().exec("cmd.exe /C start " + comando);
} catch (IOException ex) {
}
System.out.println(actionCommand);
JOptionPane.showMessageDialog(null, "Arquivo criptografado");