I have a shell script to automate the creation of separate tar files for several directories; cd’ing to each and calling the command:
tar cf pakage1.tar *.csv *.fmt
Most directories contain .fmt and .csv files, I need a solution for when a *.csv may not exist but *.fmt does and therefore a tar is required. I haven’t found an ‘ignore wildcard if not found’ command, does one exist?
Thankyou in advance.
Use
findin combination withxargs:-print0and-0to use null-separators instead of spaces otherwise it will choke on filenames with spaces in them.