back
▲ 1 points

Show HN: Merge Folders from the CLI

by xk3·2y ago·0 comments·view on hn ↗
Whenever moving folders with folders which have the same names I would always wince when seeing "directory not empty" or "destination already exists" and then immediately give up and use a GUI file manager.

The existing solutions all have caveats:

    mv ./src/* ./dest/  
oops no dotfiles ?! but also this will fail if any of the globbed subfolders have subfolder conflicts (and it will silently move globbed folders into subfolders of the same name--I can't imagine this is what most people assume it is doing)

    rsync --remove-sent-files
    rclone move 
rsync and rclone will copy the files to move them which can be very slow when renaming is all that is needed

So I've created my own which uses BSD syntax:

    pip install xklb
    library merge-mv folder1  folder2/  # folder1 will go inside folder2
    library merge-mv folder1/ folder2/  # folder1 will be merged with folder2
https://github.com/chapmanjacobd/library/blob/main/xklb/fold...
// no comments yet