简体   繁体   中英

Ruby dir path exclude directory from path

now i'm importing this directory

Dir["#{Rails.root}/app/{views,controllers}/**/**/**/**"]

but i want to exclude one directory in a specified position

Dir["#{Rails.root}/app/{views,controllers}/#All directory but exclude 'admin'#/**/**/**"]

any help?

尝试

Dir["#{Rails.root}/app/{views,controllers}/**/**/**/**"].reject { |f| f["#{Rails.root}/app/{views,controllers}/admin/"]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM