我需要从程序执行命令。命令行没问题,我在终端试了下,在程序里不行。
我从我的代码中添加了一个副本:
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
System.out.print("\n" +filename);
Process p = Runtime.getRuntime().exec("exiftool -a -u -g1 -j videos/"+filename+">metadata/"+filename+".json");
}
该程序必须获取文件夹中所有文件的名称(文件名)并提取这些视频的元数据,将它们写入文件夹“元数据”中的 .json 文件中。
问题出在哪里?