How to copy files from one directory to another directory with the subfolders copied.
If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*.
I do not want to create sub folders in folder2.
Can copy command create them automatically?
i m using the command
find /directory1/sub1/ -name $file -exec cp -p {} /directory2/lib/ \;
but in the "sub1" folder i have subfolders and files, which are copied as all files in the single folder "lib" but not creating the subfolders present in the "sub1". I need those subfolders also to be created and copied.
Sorry that i did not put that in a clear way. I do not want to create the folders by myself. I want the copy command to create itself the subfolders and copy the files.