tags:

views:

16

answers:

1

Hi!
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

+1  A: 

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
Dennis Williamson
That was the poroblem!!Thank you so much!
mujer esponja