1

I want to run a command against a bunch of files in a directory and send the output of the command to a separate .csv file for each .ts file.

The command I want to run is :

ffprobe -print_format csv -show_packet <filename.ts> > <filename>.csv

I am trying to script this so it does each .ts file in the folder

forfiles -s -m*.ts -c"ffprobe -print_format csv -show_packets @FILE > @FILE.csv"

If I have the redirect where it is it throws an error in ffprobe, if I have the redirect outside of the quotes, it redirects all output to the same file (@FILE.csv).

Freelancer
  • 836
  • 1
  • 14
  • 47
Jason Froese
  • 11
  • 1
  • 2

1 Answers1

2

You'll have to use CMD /C if you intend to use redirection: forfiles without cmd /c

forfiles -s -m*.ts -c " cmd /c ffprobe -print_format csv -show_packets @FILE > @FILE.csv"
robe007
  • 3,523
  • 4
  • 33
  • 59
npocmaka
  • 55,367
  • 18
  • 148
  • 187