I want to delete my parent directory but keep all of its content. Currently my directory structure
$ /usermanagement/usermanagement/file1
After deleting my parent directory I want to see like bellow structure
$ /usermanagement/file1
May be I didn't understand your question properly. But the answer of what I have gathered from your question is,
Assuming you are in current directory, which name is
nested
and parent directory name istest
.
$ cp -Rp . ../;cd ../;rm -rf nested
cp -Rp . ../
- This will copy all files including directory, nested directory and hidden files. Where,
-R
flag is used for "copy directories recursively"
-p
is to "preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all",
.
is for indicating of current directory as source
..
indicating as parent directory as destination.
cd ../
- This will move you from current to parent directory
rm -rf nested
- This will remove all the files including directories, nested directories and hidden files.
Sources: Man page
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments