Using forfiles with multiple file types for search mask?

后端 未结 2 1493
南方客
南方客 2020-12-03 05:15

Following command works fine with one type of files ,

forfiles -p \"C:abc\\del\" -s -m *.exe -d -70 -c \"cmd /c echo @path\"

Is it possible

2条回答
  •  清歌不尽
    2020-12-03 05:55

    It's also possible to traverse the directory structure in a single pass and test each file extension with an IF.

    forfiles -p c:\ -s  -c "cmd /c (if @ext==\"exe\" echo @path) & ( if @ext==\"dll\" echo @path) &  ( if @ext==\"xyz\" echo @path)"
    

    Just remember to escape the inner quotes \"dll\" instead of "dll", because the whole command is in a single string.

提交回复
热议问题