Skip to content

Instantly share code, notes, and snippets.

@peterhel
Created September 20, 2024 07:27
Show Gist options
  • Select an option

  • Save peterhel/25477ed9114f2b71e37bfef5f98696d5 to your computer and use it in GitHub Desktop.

Select an option

Save peterhel/25477ed9114f2b71e37bfef5f98696d5 to your computer and use it in GitHub Desktop.
Move all files from one folder into another with folder structure intact using `find`
find from-dir/ -name '*.txt' -exec bash -c 'export A="$(dirname {})"; mkdir -p to-dir/$A && mv {} to-dir/{}' \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment