Posts Tagged ‘linux’

Replace symlinks with source

Tuesday, February 16th, 2010


find . -type l -exec stat {} --format=%N \; | /root/move_symlink.pl | sh
find . -type f -exec chmod 644 {} \;
find . -type f -exec chown apache:apache {} \;

move_symlink.pl

#!/usr/bin/perl
while(<>) {
/^.(.*?)' -> .(.*)'$/;
print "mv '$2' '$1'\n";
}