Created fileUtil
This commit is contained in:
25
source/filesUtil.rb
Normal file
25
source/filesUtil.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
require 'FileUtils'
|
||||
|
||||
class Filesutil
|
||||
def findFilesByFileName(path,filename)
|
||||
files = Dir["#{path}/**/#{filename}"]
|
||||
return files
|
||||
end
|
||||
|
||||
def getExpandedPathByFileName(file)
|
||||
return File.expand_path(file.to_s)
|
||||
end
|
||||
|
||||
def removeFile(file)
|
||||
FileUtils.rm(getExpandedPathByFileName(file))
|
||||
end
|
||||
|
||||
def getDirectoryNameByFile(file)
|
||||
return File.dirname("#{file}")
|
||||
end
|
||||
|
||||
def getAllFilesByPath(path)
|
||||
return Dir["#{path}/*.*"]
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user