Skip to main content
1 of 3
Kevin
  • 41.7k
  • 17
  • 91
  • 113

The key was the -maxdepth option. Final answer, dealing with spaces appropriately:

find mydir -maxdepth 1 -type f -print0 | xargs -0 tar cvf mydir.tar

This should also work:

find mydir -maxdepth 1 -type f -exec tar cvf mydir.tar {} +
Kevin
  • 41.7k
  • 17
  • 91
  • 113