Is it possible to pipe with cd command [closed]

A pipeline takes the output of one command and uses it as the input to another command.  So there are two problems with what you tried.

  1. The cd command doesn’t produce any output1.
  2. file * doesn’t take any input.  You might say, “Of course it takes input; it reads (part of) all the files.”  But it doesn’t read standard input.  If you type file *, it just runs and gives you its output; it doesn’t read anything from the keyboard.

What you want is cd x; file *, to do the cd and then the file *.

As you may realize, that command line will leave you in directory x.  So an alternative is

(cd x; file *)

which runs the cd and the file in a subshell.  The working directory of you main shell won’t change.  A drawback of that is that, if the command line sets any shell variables or otherwise changes the shell’s state, that will also affect only the subshell and not the main shell.

________________
1 Well, sometimes it outputs the directory name.