Link to home
Start Free TrialLog in
Avatar of bkreynolds48
bkreynolds48

asked on

use find to get files from one day and pipe to tar

I have been trying to figure out how to find all files in a directory that have date of say Dec  1 and tar them to a file.
Any help would be appreciated
SOLUTION
Avatar of jhartzen
jhartzen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent point jhartzen - thanks for the clarification.  This is a minor point, but the syntax of your last command needs some spaces and another quote, i.e.

ls -laR|grep 'Dec 1 ' | awk '{ print $9 }' | xargs tar cvf $TARFILE

Yet another way to accomplish this is the following:

ls -laR| grep 'Dec 1 ' | cut -c55- | xargs tar cvf $TARFILE