08-16-2002
3,093,
36
Join Date: Apr 2002
Last Activity: 28 March 2019, 4:00 PM EDT
Location: On my motorcycle
Posts: 3,093
Thanks Given: 2
Thanked 36 Times in 11 Posts
Read the Man Page - the find command has the means to grab the files and move them, delete them, or rename them.
Part of the man page -
Remove all files in your home directory named a.out or *.o
that have not been accessed for a week:
example% find $HOME \( -name a.out -o -name '*.o' \) \
-atime +7 -exec rm {} \;
Note the last portion - -exec rm - you can change that to what you need. Practice on a test directory until you understand it. When I first started in UNIX (from VAX/VMS) my new boss had me write a script to rename soft links to hard links. I killed my test system one time because I forgot the \; on the end (or messed it up somehow). Anyway, his whole point was to teach me UNIX does not forgive - you tell it to do something screwy, it will.