Last active
December 12, 2023 05:28
-
-
Save vjvelascorios/be94cb6371e03523542c528c1f85c2db to your computer and use it in GitHub Desktop.
cli tool to dump all files inside child folders to the upper level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##!/bin/bash | |
# | |
#notes: | |
# - yes, maybe mv /a/b/*.extensionfile /a/b it's simple | |
# - just move this file to /usr/local/bin/ | |
# - from 6 to 13 is a first experiment with this tool | |
# - to move files safely to bin is necessary install trash-cli | |
# - rsync was replaced for simple mv command for a better performance | |
#!/bin/bash | |
# directory | |
directorio_principal="$PWD" | |
# moving files recursively with mv | |
find "$directorio_principal" -mindepth 2 -type f -exec mv -u -t "$directorio_principal" {} + | |
# sending empty folders to trash bin | |
find "$directorio_principal" -mindepth 1 -maxdepth 1 -type d -exec trash-put {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment