Hello all!
I'm pretty new to bash scripting, so this should be a pretty easy question to solve.
For the last few hours, I've been creating a script that will list some of the following (based on a path I specify):
- # of directories
- # of files
- # of executable files
- files older than 365 days
- and more...
What I need help with doing is coming up with a "find" command that will do the above items (and more) by passing over all my specified directory files ONLY ONCE.
When running my script, I'll do:
./myscriptname /home/alphekka
In my bash file, if no path is specified, then I'll return an exit code of 1.
I'm guessing I'm going to need to do something like this:
#!/bin/bash
find $1 \( -type f $variable1 \), \( -type d $variable2 \)
Then towards the end of my script I'll do:
printf "# of files: $variable1 \n"
printf "# of directories: $variable2 \n"
printf "etc.... \n"
Hopefully this'll be an easier to solve question. I appreciate any help anybody may be able to give me. Thank you most kindly in advance!