首页 > 解决方案 > system2 命令没有结果

问题描述

我有一个脚本,用于分析 R Studio 中的一些音频数据。该脚本运行没有错误,但是当我执行它时,它什么也不做。我认为这可能是 system2 命令的问题。任何帮助都非常感谢,我什至没有错误信息就不知所措

这是我的代码-

# Set the directory containing the files
directory <- "D://Alto//Audio 1//Day 2//"
# The directory to store the results
base_output_directory <- "D://Ecoacoustics//Output//indices_output//"

# Get a list of audio files inside the directory
# (Get-ChildItem is just like ls, or dir)
files <- list.files(directory, pattern = "*.wav", full.names = TRUE)

# iterate through each file
for(file in files) {
 message("Processing ", file) 

  # get just the name of the file
  file_name <- basename(file)

  # make a folder for results
  output_directory <- normalizePath(file.path(base_output_directory, file_name))
  dir.create(output_directory, recursive = TRUE)

  # prepare command
  command <- sprintf('audio2csv "%s" "Towsey.Acoustic.yml" "%s" ', file, output_directory)

  # finally, execute the command
  system2('C://Ecoacoustics//AnalysisPrograms//AnalysisPrograms.exe//', command) 
}

标签: rsystem2

解决方案


推荐阅读