shashi / FileTrees.jl

Parallel computing with a tree of files metaphor
http://shashi.biz/FileTrees.jl
Other
88 stars 6 forks source link

mv to different parent folder #50

Closed jkrumbiegel closed 3 years ago

jkrumbiegel commented 3 years ago

I have a tree structure in one folder, want to process files and then store basically the same folder structure with the processed files in a different place. I couldn't figure out how to do that with mv because it seems the regex only matches from the first subfolder down. I'm sure I'm just misunderstanding something, so I'd appreciate any advice

shashi commented 3 years ago

Oooh! mv is a lazy move of contents within a tree...

You can use save along with rename to actually write your new tree to a dir.

save(rename(tree, "new_dir")) do f
   ... define how to save a single file f ...
end

This is a basic operation, should probably be more clearly documented...

jkrumbiegel commented 3 years ago

Aha thanks, see I figured that shouldn't be so hard :) I completely missed rename, but probably because I was not thinking about "names" and it was not used in any of the examples I saw. The saving example uses a much fancier renaming scheme, maybe an additional simpler example for saving could also help here.