minor change
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 13 Feb 2012 20:42:22 +0000 (20:42 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 13 Feb 2012 20:42:22 +0000 (20:42 +0000)
forester/ruby/scripts/mv_slinks.rb

index f024d94..e3a3f30 100755 (executable)
@@ -1,21 +1,31 @@
+#NEW_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN3_no_bias_250/'
+#OLD_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN30b3_no_bias_240/'
 
-NEW_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN3_no_bias_250/'
-OLD_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN30b3_no_bias_240/'
+NEW_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN3_no_bias_260/'
+OLD_DIR = '/home/czmasek/WORK/GENOME_HMMPFAM/HMMSCAN3_no_bias_250/'
+
+# this need to be run in the dir where the links to be moved are
+# need to create a dir named 'newdir' first
 
 Dir.foreach('.') { |f| 
   if File.symlink?( f )
      link = File.readlink( f )
      puts f + ' -> ' + link 
    
-     link =~ /\/([^\/]+)\/([^\/]+)\.hmmscan30b3_240/
+     link =~ /\/([^\/]+)\/([^\/]+)\.hmmscan_250/
      group = $1
+     
      core_name = $2
      puts '  => ' + group + ' / ' + core_name
-     new_link = NEW_DIR + group + '/' + core_name + '.hmmscan_250'
+     new_link = NEW_DIR + group + '/' + core_name + '.hmmscan_260'
      puts '  => ' + new_link
      puts
-     if ( !File.exists?( new_link ) || !File.exists?( link ) )
-        puts 'ERROR!'
+     if ( !File.exists?( new_link ) )
+        puts 'ERROR ' + new_link.to_s + ' does not exist'  
+        exit
+     end
+     if ( !File.exists?( link ) )
+        puts 'ERROR ' + link.to_s + ' does not exist' 
         exit
      end
      #what is called new_link will by linked to by 'newdir/' + f.to_s:
@@ -24,4 +34,4 @@ Dir.foreach('.') { |f|
 }
 
 
-#File.symlink("testfile", "link2test")