Gabelins
Gabelins

Reputation: 285

Iterating over files in a folder (Windows machine)

I wrote a command to iterate a certain operation over all the files in a folder. It works perfectly from shel on a linux machine but I cannot make it working on a windows machine....and I need to make it working on a Windows one. The command looks like this:

ls |grep -v _output| while read file; do ..\..\..\program.exe [option] ..\..\input_file "$file" > "$file"_output; done

I get errors with ls and while and grep. Any suggestion is very welcome!

Gab

Upvotes: 0

Views: 87

Answers (1)

Showtime
Showtime

Reputation: 266

ls, while, and grep are not natively supported by Windows. I would suggest installing Cygwin; if that's not an option, the machines you need to run this on may have PowerShell installed.

Upvotes: 1

Related Questions