Created
November 14, 2019 16:09
-
-
Save georghildebrand/01e93cc36b1dc36d1014b9e0bd490df2 to your computer and use it in GitHub Desktop.
copy files younger than x days to new location and delete files older than x there
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='/srv/dev-disk-by-label-' | |
target='/srv/dev-disk-by-label-' | |
days=30 | |
# delete | |
find ${target} -mtime +$days -type f -exec rm "{}" \; | |
find ${source} -mtime -$days -type f -exec cp -a "{}" ${target} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment