Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Linux: How to move all files from current directory to upper directory?

I have foo/bar/myfiles and I want foo/myfiles.

I was trying to git clone a repo into foo, but it made the name of the repo as a folder and put the files in there. I'm thinking of just cloning into the same directory as foo and then renaming it, but I'd rather find a solution to this problem.

I'm working on my server, so a solution for linux would be nice, but I do this a lot on my local machine, so if there's something that can be done for Windows as well, I'd appreciate it.

share|improve this question

marked as duplicate by slhck, Hello71, Not Kyle stop stalking me, KronoS, Dennis Jul 21 '12 at 14:04

This question was marked as an exact duplicate of an existing question.

To clarify, are myfiles some files, or is that a folder? – slhck May 16 '12 at 23:01

There are a number of ways to go about this, such as:

mv foo foo2
mv foo2/bar foo
rm -rf foo2

(assuming foo is empty save for the folder bar)

Edited for errors pointed out by slhck

You can also tell it where to clone the repository in the future:

git clone git://repo/bar.git foo
share|improve this answer
Only if myfiles is a folder. If the OP cloned a Git repo into bar, then obviously, this won't work. The question's ambiguous in that respect though, since the title talks about "middle" folder, while myfiles would be an indication of … well, some files. In that case, you'd have to make sure to move Git's hidden files as well. – slhck May 16 '12 at 22:59

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