jedrichards/grunt-rsync

Create destination folder if does't exists

skotchio opened this issue · 7 comments

Is it possible to create destination folder if one dosen't exists?

rsync will automatically create a destination folder one level deep if it doesn't exist, but it won't create any nested folder structures that don't exist.

If you need to make folder structures from grunt there are tasks like grunt-shell which let you call arbitrary shell commands ...

Unfortunately grunt-shell doesn't sync files. I think it would be useful if grunt-rsync will create folder structures

The idea with Grunt is you define a lot of different tasks in your Gruntfile and then run them sequentially. So its fine to have a grunt-shell task fire first to prepare the directory structure, and then a grunt-rsync task to the sync the files, for example.

ok thanks

With all of rsync's capabilities and subtleties why doesn't it allow you to create folder substructures?

I'm not sure. I guess it comes down to the Unix philosophy that each tool should just do one thing, and one thing well. rsync is for syncing the contents of folders, not setting up new folder structures. If you think about it, setting up new folder structures in new locations comes with its own set of complexities that could end up complicating rsync's primary purpose. I do sympathise though, it would seem like a handy addition. Although creating a new folder structure is only a mkdir -p command away ...

Thanks. Thought I could easily simplify down to one tool for both local builds and deployment, but not quite as easy as I imagined. Going with the Unix flow.