I have a bunch of .zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
How would I do move them all to a common base folder?
command linefilesfindrecursive
I have a bunch of .zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
How would I do move them all to a common base folder?
Best Answer
Go to the toplevel directory of the tree containing the zip files (
cd …
), then runThis works out of the box in zsh. If your shell is bash, you'll need to run
shopt -s globstar
first (you can and should put this command in your~/.bashrc
). If your shell is ksh, you'll need to runset -o globstar
first (put it in your~/.kshrc
).Alternatively, use
find
, which works everywhere with no special preparation but is more complicated:If you want to remove empty directories afterwards, in zsh:
In bash or ksh:
and repeat as long as there are empty directories to remove. Alternatively, in any shell