I want to find all .c files in current directory and subdirectories and tar them. I try to use the following way to achieve this goal but when i unzip files, the files in different folders. I don't want to include directory when I tar the file.
The script should exclude all other files and should not maintain the directory structure for these .c files.
find . -name '*.c' | xargs tar -rf allcfiles.tar
.