D
Dafydd Fontenot
On my system I have this small ruby script as a test to arrange files.
I'm using "find" and trying to get the files sorted starting with the
files the farthest away from the base folder first in the array (so the
files nested in the most sub directories are first on the array).
Here's what the script looks like
test = Array.new
`find /folder/place -type f`.split("\n").each do |file|
test.push(file)
end
test.sort_by { |file| file.gsub(/[^\/]/, "").length }
puts test
However when I run the script the files are not actually organized any
different than what find returns.
Can someone correct me on my methodology?
I'm using "find" and trying to get the files sorted starting with the
files the farthest away from the base folder first in the array (so the
files nested in the most sub directories are first on the array).
Here's what the script looks like
test = Array.new
`find /folder/place -type f`.split("\n").each do |file|
test.push(file)
end
test.sort_by { |file| file.gsub(/[^\/]/, "").length }
puts test
However when I run the script the files are not actually organized any
different than what find returns.
Can someone correct me on my methodology?