451 EXAMPLES
452 Example 1 Writing Out the Hierarchy Directory
453
454
455 The following commands are equivalent:
456
457
458 example% find .
459 example% find . -print
460
461
462
463
464 They both write out the entire directory hierarchy from the current
465 directory.
466
467
468 Example 2 Removing Files
469
470
471 The following comand removes all files in your home directory named
472 a.out or *.o that have not been accessed for a week:
473
474
475 example% find $HOME \( -name a.out -o -name '*.o' \) \
476 -atime +7 -exec rm {} \;
477
478
479
480 Example 3 Printing All File Names But Skipping SCCS Directories
481
482
483 The following command recursively print all file names in the current
484 directory and below, but skipping SCCS directories:
485
486
487 example% find . -name SCCS -prune -o -print
488
489
490
491 Example 4 Printing all file names and the SCCS directory name
|
451 EXAMPLES
452 Example 1 Writing Out the Hierarchy Directory
453
454
455 The following commands are equivalent:
456
457
458 example% find .
459 example% find . -print
460
461
462
463
464 They both write out the entire directory hierarchy from the current
465 directory.
466
467
468 Example 2 Removing Files
469
470
471 The following command removes all files in your home directory named
472 a.out or *.o that have not been accessed for a week:
473
474
475 example% find $HOME \( -name a.out -o -name '*.o' \) \
476 -atime +7 -exec rm {} \;
477
478
479
480 Example 3 Printing All File Names But Skipping SCCS Directories
481
482
483 The following command recursively print all file names in the current
484 directory and below, but skipping SCCS directories:
485
486
487 example% find . -name SCCS -prune -o -print
488
489
490
491 Example 4 Printing all file names and the SCCS directory name
|