-1

I have too many files being in directories with same name EXAMPLE:

~/foo/bar/foo/bar/1.flac
~/foo/bar/foo/bar/bar/foo/foo/0.flac

I want to have

~/foo/bar/0.flac
~/foo/bar/1.flac

closed as unclear what you're asking by jasonwryan, Michael Durrant, Ramesh, polym, Networker Sep 12 '14 at 3:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • downvote more, what do you wanna accomplish? – user83873 Sep 11 '14 at 17:54
  • The question is really ambiguous, do you want ~/foo/bar/FILE all the time? How should the script know when to move files or when to leave them alone? You aren't helping people answer your question, you're saying "do this for me". – alexmherrmann Sep 11 '14 at 18:05
  • @alexhairyman yes.The script should know to move FILE up to /foo/bar whatever foo and bar is. – user83873 Sep 11 '14 at 18:46
  • -1 for me too. "I haz no code for u" without more details. – Michael Durrant Sep 11 '14 at 21:02
  • possible duplicate of Flattening a nested directory – Ramesh Sep 11 '14 at 21:17
1

As long as all the files have different names you can do:

cd ~/foo/bar
find foo -type f -name "*.flac" -exec mv -t . {} \;

(you can leave out the -name "*.flac" part).

Not the answer you're looking for? Browse other questions tagged or ask your own question.