Skip to main content

Posts

Showing posts from June, 2008

How to create customized, windows installers of Tomcat server

To create customized, windows installers of Tomcat server (including an option to allow the user to install it as a windows service) you can modify the ".nsi" installation script provided in the " res " folder. You can find the res folder when you download Tomcat's source code. For more information on nsi scripts please visit http://nsis.sourceforge.net/Main_Page .

Securely erase files and folders recursively in Linux

This ruby script will securely erase files and folders recursively in Linux. You may want to add a action to run this script to the context menu of Nautilus using nautilus-actions . # # Shreds files and folders recursively. Code released under MIT license. NUMBER_OF_PASSES = 20 def shred_files_and_folders(path) if File.directory?(path) files = Dir.entries(path) files.delete_if {|x| x == "." or x == ".." } files.each do |f| if File.directory?(path + '/' + f) shred_files_and_folders(path + '/' + f) else puts ` shred -v -z -u -n#{NUMBER_OF_PASSES} #{path + '/' + f}` end end Dir.rmdir(path) else puts ` shred -v -z -u -n#{NUMBER_OF_PASSES} #{path}` end end ARGV.each do |path| shred_files_and_folders(path) end

Script to delete old backups files created with Cobian Backup

The following ruby code will delete from a folder old backups files created with Cobian Backup. The deletion is recursive, so all the folders within the folder will be cleaned. # # Deletes old backups made with Cobian Backup. This code is released under the MIT license. NUMBER_OF_FILES_TO_KEEP = 6 def delete_old_backups(path) files = Dir.entries(path) files.sort! {|x,y| y <=> x } files.delete_if {|x| x == "." or x == ".." } name_of_file = " " new_name_of_file = "" file_cnt = 0 files.each do |f| puts f new_name_of_file = f.split(" ")[0] if new_name_of_file != name_of_file file_cnt = 0 name_of_file = new_name_of_file end if File.directory?(path + '/' + f) delete_old_backups(path + '/' + f) end file_cnt = file_cnt + 1 if file_cnt > NUMBER_OF_FILES_TO_KEEP puts "delete " + path + '/' + f File.delete(path + '/' + f)