Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File.open('result.txt','w') do |f| #Make new file name result.txt
- path = "C:\\Users\\eucharis\\Desktop" #Your Path
- shellscript = `dir /s #{path} |find "File(s)"` #Run Shell Command and Select Target Lines
- result = shellscript.split("File(s)").last.to_s #Split Lines to Array And Select Last Line And Convert to String
- result = result.sub(/bytes/,'').sub(/ /,'') #Remove 'bytes' and empty string in Result
- until result.scan(/,/).count.to_i <= 0 do #Loop for remove ',' in Result
- result = result.sub(/,/,'')
- end
- f.puts(result) #Write File
- end
Add Comment
Please, Sign In to add comment