I'm using the ruby library Net-SFTP to upload a folder of a files to a remote server using the upload! command, and finding that when I regain control, the folder has not finished uploading. It wouldn't be all that important except for the fact that I need to change the permissions of this folder and I can't accomplish them through the upload command due to a umask on the remote server. I do not have a root account on the remote server, so basically I need to wait for the folder to be there, then change its permissions. When I try to change the permissions, sometimes the folder is not there yet, but will show up eventually. I guess my question is two-fold.
1.) Why isn't the blocking call to upload! actually blocking until the folder has been created. 2.) Is there some way of forcing it to block with a lower level call, or do I have to wait a couple of seconds and then poll to see if the folder is there yet?
UPDATE: I suspect the real issue is because I'm trying to change permissions over a separate ssh connection, which may or may not be the same machine as I'm logging into a cluster. In other words, the folder has been created on one machine, but it hasn't been replicated across the others by the time I try to change permissions. Is there some way to close a question?