How to check if the file is a binary file and read all the files which are not?

后端 未结 13 897
走了就别回头了
走了就别回头了 2020-12-05 16:58

How can I know if a file is a binary file?

For example, compiled c file.

I want to read all files from some directory, but I want ignore binary files.

13条回答
  •  無奈伤痛
    2020-12-05 17:36

    You can do this also by leveraging the diff command. Check this answer:

    https://unix.stackexchange.com/questions/275516/is-there-a-convenient-way-to-classify-files-as-binary-or-text#answer-402870

提交回复
热议问题