I have a directory that is unpacked, but is in a folder. How can I move the contents up one level? I am accessing CentOS via SSH.
Just to make it crystal clear, taken from Rudu's answer above, and the comments.
If you need to move all the contents, INCLUDING files that start with a . (like .htaccess, .git, etc), you need to include both * and .* in your command. Like so:
mv subfolder/* subfolder/.* .
That will move contents of subfolder to your current folder. Note the space before the last ".".
This is possible with the following methods:
rsync -vua --delete-after foo/ .
cp -vaR foo/. . && rmdir foo/
shopt -s dotglob # Includes filenames beginning with a dot. mv -- foo/* . # Where foo/ is the folder consisting the files. shopt -u dotglob # Disables previously enabled dotglob option.
foo/is your folder whose content is to be moved one level up.
mv(as suggested here):
mv foo/* foo/.[^.]* . && rmdir foo/
Note: It would miss a file called
Note: For POSIX shells, you need