How to recursively go through all local or remote directories

Posted on in Categories CentOS, Linux, programming, Shell scripting, Tips, Ubuntu Linux, UNIX last updated December 2, 2007

You can use find command or recursdir command to recurse through local or remote directories to command/find files or create tar files.

recursdir command pass a C script to recursively perform operations on files. recursdir is an excellent tool for automatic stuff. It provides C style programming functions and statements such as:

  • strncmp()
  • exec()
  • system()
  • strstr()
  • strcat()
  • printf()
  • popen()
  • if ( expr ) { take-action }
  • if ( expr ) { take-action } else { do-something-else; }
  • /* comments */
  • Detecting file types and macros
  • All of the logical, arithmetic and bitwise C operators are supported. These are ( ) >= < = > < != == && || ! - + * / % & ^ and have the same meanings and precedences as in C. etc.

Continue reading “How to recursively go through all local or remote directories”

Linux / UNIX: Find Out If File Exists With Conditional Expressions in a Bash Shell

Posted on in Categories Howto, Linux, RedHat/Fedora Linux, Shell scripting, UNIX last updated May 2, 2017

With the help of BASH shell and IF command, it is possible to find out if a file exists or not on the filesystem. A conditional expression (also know as “evaluating expressions”) can be used by [[ compound command and the test ([) builtin commands to test file attributes and perform string and arithmetic comparisons.