marcusbuffett / pipe-rename

Rename your files using your favorite text editor
https://crates.io/crates/pipe-rename
MIT License
397 stars 12 forks source link

Create directories if needed #43

Closed IndianBoy42 closed 1 year ago

IndianBoy42 commented 2 years ago

Right now if you add/change the directory part of the path then it will (silently) fail. It seems to work correctly if I try to move it to an existing directory.

We would have to add some mkdir -p calls (or equivalent), either after detecting that the directory doesn't exist or just always doing so.

It might also be nice to be able to delete (clear the line) or create (touch) files (add a new line to the end), but that might be even more out of scope

jtrv commented 2 years ago

I agree I think being able to create directories would be a great addition. Here is an implementation of this feature for a similar tool written in golang https://github.com/itchyny/mmv/blob/c44dfa50989aa1d337dd2dbdc5b47dc6595b55f8/mmv.go#L34