Linux: Duplicate a Structure with Symbolic Links

Question:  WHY???

Answer:  In my case, I’d like to copy the default adminhtml theme but have everything linked back to the original theme… Weird, I know… but my reasoning makes sense.  I want to be able to replace specific files/etc without having to worry about the upgrade process replacing or when it comes time to update from the latest, to figure out what I changed, yada yada..  I wrote a quick set of commands to create all the dirs and symlink them from the skin/adminhtml/package/theme dir:

# Step 1: Make all the directories.
dirs=`find ../../default/default/ -type d`
for dir in $dirs;
	mkdir ${dir/..\/..\/default\/default\//};

# Step 2: link all the files.
files=`find ../../default/default/ -type f`
for file in $files;
	ln -s $file ${file/..\/..\/default\/default\//};

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.