On Tue, 29 Aug 2006, Russ Wright wrote:
> Hello fellow sluggers!
>
> I have a scripting question. I want to create a script that will create
> symbolic links to a directory structure in another folder. for example:
> I have a whole bunch of folders and php files in a directory
> called /var/codebase I want to create a script the will copy the
> directory structure to /home/something/public_html/ and create symlinks
> to the files in the first directory.
>
> so my questions:
>
> 1. What would be the best language? Perl perhaps?
>
> 2. Is this possible? if so how?
Can you assume that the files in /home/something/public_html/ have no spaces
or other nasty characters? Probably not, but if so it's easy:
for file in `find /home/something/public_html/` ; do
ln -s $file /var/codebase/$file
done
If you want to trim off stuff from the beginning of $file bash's ${foo#bar}
construct comes in handy.
If $file might contain special chars, it gets more complicated.
find /home/something/public_html/ | while read file ; do
ln -s "$file" "/var/codebase/$file"
done
maybe?
-- -eben QebWenE01R@vTerYizUonI.nOetP royalty.no-ip.org:81Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:16:43 EDT