z3cka
25th August 2006, 07:36
I have a situation in which i have many directories with one file in each of them. I would like to write a script that would go into each directory and copy the file in that directory one level up.
For example, i would like the *.txt files here:
/startingDirectory/
-->dirA/
------>fileA.txt
-->dirB/
------>fileB.txt
To be copied or moved to yeild:
/startingDirectory/
-->dirA/
-->dirB/
-->fileB.txt
-->fileA.txt
*** the *.txt files can be copied or moved i don't have a preference.
I would like to do this in a linux bash shell. The names of the files should be arbitrary to the scripts. It should be able to just move to each directory recursively.
Thank you in advance, please let me know if i was not specific enough.
For example, i would like the *.txt files here:
/startingDirectory/
-->dirA/
------>fileA.txt
-->dirB/
------>fileB.txt
To be copied or moved to yeild:
/startingDirectory/
-->dirA/
-->dirB/
-->fileB.txt
-->fileA.txt
*** the *.txt files can be copied or moved i don't have a preference.
I would like to do this in a linux bash shell. The names of the files should be arbitrary to the scripts. It should be able to just move to each directory recursively.
Thank you in advance, please let me know if i was not specific enough.