Need help writing simple copy script

Discussion in 'Programming/Scripts' started by z3cka, Aug 25, 2006.

  1. z3cka

    z3cka New Member

    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:


    To be copied or moved to yeild:


    *** 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.
  2. z3cka

    z3cka New Member

    Just an update

    I have found some help here: including some code.
    Please feel free to stop by and see if it helps the thought process a little. I don't mind if you post any solutions here. i will be back, as well as posting the solution here when we figure it out.

    Thanks again!
    Last edited: Aug 26, 2006
  3. falko

    falko Super Moderator ISPConfig Developer

    As far as I can see from the link, you're close to the solution. Anyway, I recommend to have a look at this guide, it's almost essential if you want to do shell scripting:
  4. z3cka

    z3cka New Member

    thanks falko man, i will check out that link.

    i appreciate all the good work you put in this forum. keep it up.

Share This Page