I have a directory structured like this,
/var/www/html/content/
|_dir1/
| |_somefile.txt
| |_anotherfile.js
| |_anotherfile.min.js
|
|_dir2/
|_somefile.txt
|_anotherfile.js
|_anotherfile.min.js
I want to copy dir1
and dir2
to another directory. I have tried with the following command but it copies the entire content
directory to the new location. I only need the directories inside content
to be there.
cd ~/Desktop/new_location/
cp -r /var/www/html/content/. ./
Update 2
Both,
cp -r /var/www/html/content/. ./
and
cp -r /var/www/html/content/* ./
works fine. I have mistakenly included aonther content
directory within the content
directory making it /var/www/html/content/content
Update 1
Using the command posted by @Appleoddity in the first answer on a fresh directory works. But on the actual directory which I need to copy it fails. What could be the reason for this? Check the attached image.