Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tanaypratap/5d6cf479912a69b1b08b538a8ff68bc9 to your computer and use it in GitHub Desktop.
Save tanaypratap/5d6cf479912a69b1b08b538a8ff68bc9 to your computer and use it in GitHub Desktop.
cp `ls -SF | grep .log` /path/to/where/you/want/to/copy
Note 1: notice the backtick it's not inverted comma
Note 2: if you want to copy only files ending with .log for example, training1.log (yes) but training2.log.gz (no)
then use $ like:
cp `ls -SF | grep .log$` /path/to/where/you/want/to/copy
@tanaypratap
Copy link
Author

To limit the number of files to be copied you can use grep -m 100
this copies first 100 files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment