summaryrefslogtreecommitdiff
path: root/bin/clone.csh
blob: 1c14e912d64e1a4c16cfae4a5b70dbe045c35ef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/csh

set src_root=`pwd`
set dst_root=`abspath $1`

set subdirs=`find * -type d -print`

mkdir $dst_root
set files=`find * \( -type d -prune \) -o -type f -print`

if ($#files) then
	ln $files $dst_root
endif

if ($#subdirs) then
	foreach subdir ($subdirs)
		cd $src_root
		mkdir $dst_root/$subdir
		cd $src_root/$subdir
		set files=`find * \( -type d -prune \) -o -type f -print`
		if ($#files) then
			ln $files $dst_root/$subdir
		endif
	end
endif
exit 0