<div class="gmail_quote">On Thu, Mar 18, 2010 at 9:48 AM, Mac User FR <span dir="ltr"><<a href="mailto:macuserfr@free.fr">macuserfr@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;">Wouldn't it be better to use conditional expressions from sh with a smaller footprint than rsync --list to check if the directory exists?<div>I think on something like:</div><div><span style="font-family: Times;"><pre>
-d file
         True if file exists and is a directory.</pre><pre><span style="font-family: Helvetica; white-space: normal;">(source: man sh)</span></pre></span><br></div></div></blockquote></div><br>It would if the remote file system was mounted locally - that's how I do it. However in this case rsync needs to connect to the remote filesystem via an rsync daemon running on the remote server. <br>
<br>I first thought of recommending to run rsync --list server::module , but that would be much more overhead as it would list every file under the top-level directory. Listing a sub-directory will have less files to list so will be faster. <br>
<br>The selection of which sub-directory to use is important here. You'd want to choose a sub-directory that is not likely to be deleted or renamed. Although if it is and you setup the notification command properly, you'll know about it the first time rsync tries to run. But this will not delete the files as before, so is a good solution. The other factor in the selection of the sub-directory to list is how many files it contains. Ideally it would be a small subdirectory with not many files. <br>