simple thing to undate links....
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 16 Apr 2011 20:49:42 +0000 (20:49 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 16 Apr 2011 20:49:42 +0000 (20:49 +0000)
forester/ruby/scripts/mv_slinks.rb [new file with mode: 0755]

diff --git a/forester/ruby/scripts/mv_slinks.rb b/forester/ruby/scripts/mv_slinks.rb
new file mode 100755 (executable)
index 0000000..f024d94
--- /dev/null
@@ -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")