Created
October 29, 2013 11:40
-
-
Save pogin503/7213150 to your computer and use it in GitHub Desktop.
This file contains 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 characters
root_dir = '/Users/Username/Dropbox/Documents/Study/' | |
res = Dir.glob(root_dir + "**/*.mm") | |
res1 = res.map do |e| | |
"file://" + e | |
end | |
# puts res1 | |
File::delete("index.html") | |
# File::open("index.html","a") | |
File::open("index.html", "a") do |file| | |
file.puts("<html>") | |
file.puts("<head>") | |
file.puts('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">') | |
file.puts("</head>") | |
file.puts("<body>") | |
puts root_dir | |
sub_res = root_dir.gsub(/\//, "\\\\/") | |
puts sub_res | |
res1.map do |e| | |
# filename = File.basename(e) | |
file.puts('<a href="' + e + '">' + e.gsub(/file:\/\/#{sub_res}/, "") + '</a><br />') | |
end | |
file.puts("</body>") | |
file.puts("</html>") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment