I have a fixtures directory structure
fixtures
en
alpha
beta
delta
es
alpha
beta
delta
and one rake task to remove all fixtures
path = File.join(MyApp.config.fixtures_path)
FileUtils.rm_rf(path)
or all folders w specific locale
path = File.join(MyApp.config.fixtures_path, locale)
FileUtils.rm_rf(path)
but is there a way to remove all folders with name ''alpha'' in
ALL locales
folder, and get a resulting structure
fixtures
en
beta
delta
es
beta
delta
thanks for your suggestions
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/E1ZOOMjQMCYJ.
For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell
2012-Nov-20 11:18 UTC
Re: rake task ) fileutils how to remove parent specific folder
On Tue, Nov 20, 2012 at 5:08 AM, Erwin <yves_dufour-ee4meeAH724@public.gmane.org> wrote:> I have a fixtures directory structure > > fixtures > en > alpha > beta > delta > es > alpha > beta > delta >__SNIP__> is there a way to remove all folders with name ''alpha'' in ALL locales > folder, and get a resulting structureFileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures", "**/alpha")], secure: true, force: true) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell
2012-Nov-20 11:22 UTC
Re: rake task ) fileutils how to remove parent specific folder
On Tue, Nov 20, 2012 at 5:18 AM, Jordon Bedwell <envygeeks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Nov 20, 2012 at 5:08 AM, Erwin <yves_dufour-ee4meeAH724@public.gmane.org> wrote: >> I have a fixtures directory structure >> >> fixtures >> en >> alpha >> beta >> delta >> es >> alpha >> beta >> delta >> > __SNIP__ > >> is there a way to remove all folders with name ''alpha'' in ALL locales >> folder, and get a resulting structure > > FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures", "**/alpha")], > secure: true, force: true)Sorry ommit the force, I always forget that force is implied by rf since I rarely use rf, so it should be `FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures", "**/alpha")], secure: true)`. I use r in production (and on development I trigger a force but with constraints) because I like exceptions to be raised so I know exactly what''s going on in my filesystem but not all people care about that -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Erwin
2012-Nov-20 11:37 UTC
Re: rake task ) fileutils how to remove parent specific folder
Thanks Jordon
I also discover I can use Dir.glob + match ... with directories .. (
though it was only for file
directories =
Dir.glob("#{File.join(MyApp.config.fixtures_path)}/*/\*alpha\*")
will test your answer too.. thanks again
Le mardi 20 novembre 2012 12:22:41 UTC+1, Jordon Bedwell a écrit
:>
> On Tue, Nov 20, 2012 at 5:18 AM, Jordon Bedwell
<envy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:>>
> wrote:
> > On Tue, Nov 20, 2012 at 5:08 AM, Erwin
<yves_...-ee4meeAH724@public.gmane.org <javascript:>>
> wrote:
> >> I have a fixtures directory structure
> >>
> >> fixtures
> >> en
> >> alpha
> >> beta
> >> delta
> >> es
> >> alpha
> >> beta
> >> delta
> >>
> > __SNIP__
> >
> >> is there a way to remove all folders with name
''alpha'' in ALL locales
> >> folder, and get a resulting structure
> >
> > FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures",
"**/alpha")],
> > secure: true, force: true)
>
> Sorry ommit the force, I always forget that force is implied by rf
> since I rarely use rf, so it should be
> `FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures",
"**/alpha")],
> secure: true)`. I use r in production (and on development I trigger a
> force but with constraints) because I like exceptions to be raised so
> I know exactly what''s going on in my filesystem but not all people
> care about that
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/B738n6GSFmUJ.
For more options, visit https://groups.google.com/groups/opt_out.
Erwin
2012-Nov-20 11:45 UTC
Re: rake task ) fileutils how to remove parent specific folder
Works great Jordon ! thanks again !! Le mardi 20 novembre 2012 12:22:41 UTC+1, Jordon Bedwell a écrit :> > On Tue, Nov 20, 2012 at 5:18 AM, Jordon Bedwell <envy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org<javascript:>> > wrote: > > On Tue, Nov 20, 2012 at 5:08 AM, Erwin <yves_...-ee4meeAH724@public.gmane.org <javascript:>> > wrote: > >> I have a fixtures directory structure > >> > >> fixtures > >> en > >> alpha > >> beta > >> delta > >> es > >> alpha > >> beta > >> delta > >> > > __SNIP__ > > > >> is there a way to remove all folders with name ''alpha'' in ALL locales > >> folder, and get a resulting structure > > > > FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures", "**/alpha")], > > secure: true, force: true) > > Sorry ommit the force, I always forget that force is implied by rf > since I rarely use rf, so it should be > `FileUtils.rm_rf(Dir[Rails.root.join("spec/fixtures", "**/alpha")], > secure: true)`. I use r in production (and on development I trigger a > force but with constraints) because I like exceptions to be raised so > I know exactly what''s going on in my filesystem but not all people > care about that >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KqJZoUV9s_MJ. For more options, visit https://groups.google.com/groups/opt_out.