Created
October 21, 2012 19:05
-
-
Save RoxasShadow/3928110 to your computer and use it in GitHub Desktop.
Windows hard link maker
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
#-- | |
# urls.txt | |
# D:\Users\Giovanni\Documents\Ebook | |
# D:\Users\Giovanni\Documents\4A Games | Metro 2033 | |
#++ | |
(paths = []).tap { |paths| | |
File.read('urls.txt').each_line { |path| | |
next if path.gsub(/\s+/, '').empty? | |
path.gsub!(/\n/, '') | |
ary = path.split ?| | |
name = ary.length == 1 ? path.split('\\').last : ary[1] | |
path = ary.length == 1 ? path : ary[0] | |
paths << { | |
:path => path, | |
:name => name.strip | |
} | |
} | |
}.each { |path| | |
system "cmd.exe /c mklink /D \"#{path[:name]}\" \"#{path[:path]}\"" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment