Last active
November 14, 2019 19:16
-
-
Save georghildebrand/6efcd5232d169aff136ea306bc2132ac 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 "{}" \; | |
# copy and link | |
find ${source} -mtime -$days -type f -exec cp -la "{}" ${target} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment