require_relative  'windowsFileSystem'
require_relative 'filesUtil'
require_relative  'filecreate'

@outputFile = Filecreate.new
@outputFile.filename = "files.csv"
@outputFile.create
@outputFileHeader = ["Path Size","Full Path","File Name"]
@outputFile.writeToCsv(@outputFileHeader)
@filesUtil = Filesutil.new
@fileSystem = Windowsfilesystem.new
@drives = @fileSystem.allDrives
@drives.each do |drive|
	#puts drive.DriveLetter
	#puts drive.DriveType
	if drive.DriveType == 2
		@files = @filesUtil.findFilesByFileName(drive.Path,'*.*')
		@filesTooLong = @files.select{|f| @filesUtil.getExpandedPathByFileName(f).length > 255}
		@filesTooLong.each do |file|
			@pathLength = @filesUtil.getExpandedPathByFileName(file).length.to_s
			@path = @filesUtil.getExpandedPathByFileName(file).to_s
			@path = @path.gsub("/","\\")
			@fileName = @filesUtil.getFileBasename(file).to_s
			@whatToWrite = [@pathLength,@path,@fileName]
			@outputFile.writeToCsv(@whatToWrite)
		end
	end
end