Created
February 24, 2016 17:25
-
-
Save jwieder/dd914ce765a3fb378ab7 to your computer and use it in GitHub Desktop.
Finds files of a given extension in a directory and moves them into another directory. Combine with cron to - for example - move log files to a network share for long term storage. Follows symlinks. Adjust maxdepth to increase or decrease recursion. Simple & effective!
This file contains hidden or 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 | |
Source="/var/log" | |
Destination="/to/your/backups" | |
find -L $Source -maxdepth 3 -type f -name "*.gz" -exec mv {} $Destination \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment