Created
November 16, 2011 03:15
-
-
Save christonog/1369146 to your computer and use it in GitHub Desktop.
Revisions
-
christonog created this gist
Nov 16, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ =begin first edition: 11/15/2011 I created this script in order to help me create files with the same extension quickly. It's not too powerful, but gets the job done and can be somewhat customized to suit the needs of the user (granted if they can code in ruby) Hope it helps! -Chris =end puts "This is a quick and dirty ruby script to create files quickly in the present working directory" puts "How many files do you want to create?" file_count = gets.chomp().to_i puts "what is the name of the file? For example, the 'file' in file.doc." name = gets.chomp() puts "what is the extension of the files? Sorry, it can only be one extension type (eg .doc)." file_extension = gets.chomp() for i in 1..file_count filename = "#{name}#{i}#{file_extension}" file = File.open(filename, 'a') file.write(filename) file.close() puts "#{filename} was created" end