by
3,715 20

bash: loop over directory

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/395692/bash--loop-over-directory?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
#!/bin/bash # rsync --progress -a -h --stats /example/folder/ /backup/ FILES=/example/folder/* for f in $FILES do echo "Backup $(basename "$f")" # one folder after another rsync --progress -a -h --stats "$f/" "/backup/$(basename "$f")/" done
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus