Dave Morriss says: Enjoyable show!
RE: hpr4373::2025-05-07 Rsync with stdin as source by oxofrom the series Bash Scripting.
00:20:13 Listen in
ogg,
opus,
or
mp3 format.
Thanks for this.
I liked your "stream of consciousness" approach to making a show. It was good to follow along with your thoughts.
Yes, I agree with Paulj that 'rsync' is all about updating the destination with differences detected in the source, so the 'find' seems redundant.
However, it's interesting to examine the '-print0' option. I have used it when I have files with spaces (and other weirdnesses) in their names, which I need to process. Many other commands accept null-terminated names, so this can be very useful.
Here's a case in an HPR script I wrote a long time ago when I was a "Janitor":
mapfile -d '' -t pix < \
<(find "$SHOWDIR" -maxdepth 1 -regextype egrep -regex '.*\.(jpg|JPG|png|PNG)' -print0 |\
sort -z)
It fills an array 'pix' with picture file names, avoiding problems with spaces in names (hopefully anyway!).
The "null" characters generated by find are non-printable, but you could save the output and view it with an editor, or with 'od' or 'cat -v' to "see" them.
You mentioned 'ACL'. This stands for Access Control List, a POSIX feature which gives more fine-grained access control to filesystem objects.
Looking forward to more shows like this :-)
Paulj says: Rsync - Dave
RE: hpr4373::2025-05-07 Rsync with stdin as source by oxofrom the series Bash Scripting.
00:20:13 Listen in
ogg,
opus,
or
mp3 format.
Hi Dave,
I will see if I can make a show about my media server and how I get stuff uploaded. Although I do have some "imposter syndrome" about it, because sometimes I feel that if it went wrong, I would be stumped! On the positive side, I have all my physical media, so if I did lose the digital content, it wouldn't be the end of the world (but it would be a lot of work to re-scan it).
Regarding "--delete" - I agree with your comment about the potential dangers with it. Needless to say, I took some time carefully checking it was doing what I expected, then put it in a script so I could avoid typing it incorrectly in the future!