On Monday 23 Sep 2013 23:01:53 Andreas wrote:
Hi
how can a bash script look up the contents of a directory and call another script for all files within this directory? It would be great to have those files sorted by name or create-date first before the names get thrown at the second script.
Filenames are like this Export-YYYYMMDD
Example: This first bash script is the one being called and passed the file name - - - - -8< - - - - - - - ~/prt.sh - - - - -8< - - - - - - - #!/bin/bash echo "Filename: $1" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is the control script, that cycles through the files found and calls the other script... - - - - -8< - - - - - - - ~/list.sh - - - - -8< - - - - - - - #!/bin/bash for f in `find ~/ -maxdepth 1 -type f -name "*.txt" | sort`; do ~/prt.sh $f done - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Output... $ ./list.sh Filename: /home/ritchie/Export-20120601.txt Filename: /home/ritchie/Export-20130703.txt $ -- Ritchie -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org