Search code examples
linuxmakefileconsolecommandrm

Using rm for a file in a directory


I'm new using the linux commands and I'm having a problem using the rm command in a makefile.

The makefile is in the /project directory and I want to remove all the files with extension .o that are in the /project/src folder.

I have tried with

rm /src/ -f *.o

and

rm /src -f *.o

I do not receive any error in the console but it does not delete the files either.

Could someone please help me? Thanks for your time!


Solution

  • You can delete files like this

    rm -f src/*.o
    

    -f is to force deletion, without confirmation