The title is rather more simplified than the functionality I am trying to express in a script.
I have a one-level deep directory tree (much bigger than example) which contain various content, although only two particular files are of interest to me. A file called 'current' and another called 'revisions'
- foo
|
|-> current
- bar
|
|-> current
|-> revisions
- baz
|
|-> not-affected
The script in mind would be triggered from the parent directory to foo/bar/baz and it would perform the following
- Scan all subdirectories
When it finds a directory containing 'current' it will
- Append the content of 'current' onto revisions 'cat ${pwd}/current >> ${pwd}/revisions '
- Directories not containing a file named 'current' are to remain unaffected