Skip to content

Instantly share code, notes, and snippets.

@SalvadorP
Created June 21, 2022 06:50
Show Gist options
  • Save SalvadorP/40da9fb32a03fddec457716483efcd17 to your computer and use it in GitHub Desktop.
Save SalvadorP/40da9fb32a03fddec457716483efcd17 to your computer and use it in GitHub Desktop.
Picks files by filename and then copies them to a destination folder
#!/bin/bash
# Searches for filenames and then copies them to the destination folder.
# Searches for first parameter then copies where the second says.
ls | grep "$1" | while read i; do cp -p "$i" $2 ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment