Skip to content

Instantly share code, notes, and snippets.

@joshuadanpeterson
Last active January 21, 2020 00:35
Show Gist options
  • Save joshuadanpeterson/e779c41d30c08255d1ba66b1ee4d9a07 to your computer and use it in GitHub Desktop.
Save joshuadanpeterson/e779c41d30c08255d1ba66b1ee4d9a07 to your computer and use it in GitHub Desktop.
[Bash Batch File Move By Extension] Script moves all files w/extension to related directory. #script #bash
# This script moves all files with a certain extension to a related directory.
# From: https://apple.stackexchange.com/questions/94392/how-to-copy-all-files-with-extension-filetype-in-terminal
# Script copies file with 'file ext' from 'directory folder path' into 'target folder path
# Once script is edited for task, make executable:
# - https://stackoverflow.com/questions/9825495/run-text-file-as-commands-in-bash
# Script can also be saved as plaintext file and executed in terminal as 'bash BatchFileExtMove.txt'
cp ~/<directory folder path a>/*.<file ext a> <target folder path a>
cp ~/<directory folder path b>/*.<file ext b> <target folder path b>
cp ~/<directory folder path c>/*.<file ext c> <target folder path c>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment