I have a directory structure in my machine as following
bhagwat durga Sai Baba vishnu sahastranam
bhagwat geeta hanuman ramayan audio shiv vishnu
in this all of the above are directories which have blank spaces in their names.
i.e if you do an ls -l
you will see following
drwx------ 1 deel deel 0 2011-09-12 21:34 bhagwat
drwx------ 1 deel deel 8192 2011-09-09 22:35 bhagwat geeta
drwx------ 1 deel deel 4096 2011-10-07 05:10 durga
drwx------ 1 deel deel 0 2011-10-29 09:23 hanuman
drwx------ 1 deel deel 8192 2011-09-30 22:48 ramayan audio
drwx------ 1 deel deel 4096 2011-09-18 12:16 Sai Baba
drwx------ 1 deel deel 4096 2011-09-26 19:19 shiv
drwx------ 1 deel deel 4096 2011-09-26 19:20 vishnu
drwx------ 1 deel deel 4096 2011-09-16 11:35 vishnu sahastranam
which has further sub folders in it.I DO NOT want to copy the files or directories. I want to create a directory structure as above on some other location or device.Which is analogous to what exist on source directory. Hence I am writing a script for the same as follows
#!/bin/bash
for i in `ls /media/New Volume/bhajans`;do
echo $i
done
现在,这一办法的问题在于它导致产出的完成。
bhagwat
bhagwat
geeta
durga
hanuman
ramayan
audio
Sai
Baba
shiv
vishnu
vishnu
sahastranam
如果你注意到该产出,则以名录为名称的空白处作为单独的名录处理。 这不是正确的。 因此,我如何能够消除这一问题。 我想创建与来源组合相同的目录结构。
EDIT
I am using Ubuntu 11.04
UPDATE
Each of the sub directory which was cloned has a script named script.sh so not only I am cloning the directory structure.I am also copying the script.sh from parent directories to the cloned destinations.
Kevin and Jonathan thanks for your explanations and answers.