From: cmzmasek@gmail.com Date: Sat, 16 Apr 2011 20:49:42 +0000 (+0000) Subject: simple thing to undate links.... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d0fcd8b3f9df6ca78458c661d9c43015f46365e5;p=jalview.git simple thing to undate links.... --- diff --git a/forester/ruby/scripts/mv_slinks.rb b/forester/ruby/scripts/mv_slinks.rb new file mode 100755 index 0000000..f024d94 --- /dev/null +++ b/forester/ruby/scripts/mv_slinks.rb @@ -0,0 +1,27 @@ + +NEW_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN3_no_bias_250/' +OLD_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN30b3_no_bias_240/' + +Dir.foreach('.') { |f| + if File.symlink?( f ) + link = File.readlink( f ) + puts f + ' -> ' + link + + link =~ /\/([^\/]+)\/([^\/]+)\.hmmscan30b3_240/ + group = $1 + core_name = $2 + puts ' => ' + group + ' / ' + core_name + new_link = NEW_DIR + group + '/' + core_name + '.hmmscan_250' + puts ' => ' + new_link + puts + if ( !File.exists?( new_link ) || !File.exists?( link ) ) + puts 'ERROR!' + exit + end + #what is called new_link will by linked to by 'newdir/' + f.to_s: + File.symlink( new_link, 'newdir/' + f.to_s ) + end +} + + +#File.symlink("testfile", "link2test")