Register now and start sharing your code snippets.
Recursively add files to ClearCase
Ruby posted 5 months ago by christian
This script adds all files in the current directory to ClearCase.
Save the following script as add_recursively.rb in the directory you want to add to ClearCase:
1 %x{cleartool ls -view_only -r -s . > view_private_files.txt} 2 3 lines = File.open('view_private_files.txt').readlines.collect{|line| %Q{"#{line.chomp}"} } 4 5 # Work around command line length limit in Windows 6 while lines.size > 0 7 %x{cleardlg /addtosrc #{lines.slice!(0..100).join(' ')}} 8 end
Next open a command line window and execute the script:
1 cd clearcase_vob 2 ruby add_recursively.rb
ClearCase sucks, use Mercurial or git instead…
Find a text pattern in jar files
Shell Script (Bash) posted about 1 year ago by marko
Helpful when you need to find a class or package in some jar file recursively below the current directory. Still needs a test to see if the file found was a file or directory. Works case insensitively. Uses the unzip command because of it’s performance superiority in comparison to jar.
1 #!/bin/sh 2 for f in `find . -type f -name '*\.jar'` 3 do 4 unzip -l $f | grep -i $1 && echo "was found in $f" 5 done