I have a problem to solve, and I'm stuck. I must write a Shell Command Script; I have did a little while in college, but I do not remember all to get me over the bumps that I'm facing... Or problems to the few lines that I have did with the script.
Here is the assignment:
Write a shell command that can find all files within the /www/sites/ directory tree that were modified more than 10 days ago, excluding any files with .jpg, .gif, .mov, and .avi extensions. Make the output list the path and size of said file(s).
So far... I have
#! /bin/bash # Not sure if it should be "bash" or "sh" at this point?
find /www/sites/ .-typr f -mtime +10 /xargs tar -cvf 'date' +%d%m%Y' _archive.tar' #I'm thinking that the "_archive.tar'" may not be right for assignment
$ tar --exclude= '.jpg' --exclude= '.gif' --exclude= '.mov' --exclude= '.avi'
#not sure for the rest and how to put it together right now! I do think that I need a echo command to output the information for the sites, path, size. Please help me to understand what I missing by refreshing.
Thank you, Thesnow. I'm still having trouble putting it together. Can you help line by line? I know #! /bin/bash is correct. The second line should be the assignment of a value or variable if that is remember correction. Example FILENAME= "/www/sites/". But, I not sure with search on how to use the for loop with find. I believe a nested construction, but the set up is kill me. Would some give a sample script for the above assignment, I just need to see something that I can follow and read to understand the set up.