I am using BASH to attempt to automate a very tedious manual scanning process.
I am very new to scripting and am learning as I go, but I've been googling and reading manuals for a day and a half and still haven't found anything to solve the following problem:
After SSHing into a remote server and then SCPing (sometimes thousands of) files from a second remote server...
1.) I need to count the number of files (inclusive of dotfiles (.pl, .xml, .sh, etc.)) in a directory and assign that numerical value as a variable (eg. $filecount)
2.) Then I need to use either an if or case statement to check if $filecount is >, = or < then 1. (if > 1 a previous SCP was successful, if = 1 the SCP failed or finally if < 1 something went really wrong)
Any guidance is greatly appreciated