Hi,
I would like to copy all files, let say all that begins with "file*", from ALL subdirectories into the directory with the same structure of subdirectories.
for example :
dir1--+
|
+--subDir1 --+--subSubDir1
|
+-- subSubDir2
-- subDir2
-- subDir3--+--subSubDir1
into
dir2--+
|
+--subDir1 --+--subSubDir1
|
+-- subSubDir2
-- subDir2
-- subDir3--+--subSubDir1
BUT the idea is not to create structure of subdirectories in dir2 in advance.
I started with:
for fl in `find -type f -name "file*" -print`; do
echo $fl;
done
but realised that I have not created subdirectories in dir2 and copying in that case is imposible. How to create the appropriate subdirectories within for-done cycle?
p.
I would like to copy all files, let say all that begins with "file*", from ALL subdirectories into the directory with the same structure of subdirectories.
for example :
dir1--+
|
+--subDir1 --+--subSubDir1
|
+-- subSubDir2
-- subDir2
-- subDir3--+--subSubDir1
into
dir2--+
|
+--subDir1 --+--subSubDir1
|
+-- subSubDir2
-- subDir2
-- subDir3--+--subSubDir1
BUT the idea is not to create structure of subdirectories in dir2 in advance.
I started with:
for fl in `find -type f -name "file*" -print`; do
echo $fl;
done
but realised that I have not created subdirectories in dir2 and copying in that case is imposible. How to create the appropriate subdirectories within for-done cycle?
p.