I can probably write a shell script to find files only, then pass the list to tar, but I am wondering whether there already is a built-in feature in tar that allows doing just that, in a single command line?
For example, I found the
--no-recursion switch, but when I do:
tar --no-recursion -cvf mydir.tar mydir
It only archives the names of the entries in the directory (including subdirectories!), but it doesn't archive any files.
I also tried:
tar --no-recursion -cvf mydir.tar mydir/*
But while it archives files only, it also archives the names of the subdirectories.
Is there a way to tell tar files only, no directories?