Reputation: 3563
I would like to call this shell script:
#!/bin/sh
exiftool -a -u -g1 -j videos/$filename > metadata/$filename1.json;
From a program in java. I try this:
File dir = new File("videos");
String[] children = dir.list();
if (children == null) {
// Either dir does not exist or is not a directory
System.out.print("No existe el directorio\n");
} else {
for (int i=0; i<children.length; i++) {
// Get filename of file or directory
String filename = children[i];
//Recojo el momento exacto
Process p = Runtime.getRuntime().exec("/home/slosada/workspace/Hola/Metadata.sh "+filename+" "+filename+"");
}
}
But my computer is blocked and I can't do anything. Also, there are no output files.
Maybe, the problem is in how I call the script and how I pass the parametre filename.
Any help?
Thanks in advance
Upvotes: 2
Views: 280
Reputation: 359865
You need retrieve the arguments within your shell script:
#!/bin/sh
filename=$1
filename1=$2
exiftool -a -u -g1 -j videos/$filename > metadata/$filename1.json
Upvotes: 1