Hello,
I’m using the AuthorizationShell in macoslib to try to run an rsync command. I realize AuthorizationShell is deprecated, but that’s what I’d like to use, at least for now.
I’ve basically copied the code from the macoslib example, and rsync seems to run, but instead of the normal output, which begins something like this when I run from the terminal:
building file list ...
0 files...
100 files...
114 files to consider
I just get this (and then the command finishes):
building file list ...
0 files to consider
My source folder has hundreds of files in it and my destination folder is empty, so it should definitely see files to sync. It looks like it’s having some sort of problem finding the right folders, at least that’s my guess, since it’s not actually throwing up any error messages. I’m hoping someone can see what I’m doing wrong. This is for copying media files from cameras to a hard drive using checksums to make sure there were no copy errors. It’s based on the command here. I’m just trying to wrap it into a GUI.
I originally had rsync running with no problem in a regular shell class using some of the sudo hacks discussed elsewhere on the forums, but I’d like to use an AuthorizationShell, so I’m not doing anything insecure with the password. One other note, when I was using the built-in shell class, I found that if I used the shellpath for the source and destination, I got an error, an issue with arguments and parsing spaces (even though they were escaped) in filenames. Instead, rsync wanted the nativepath enclosed in quotes. I’ve tried both here (see the commented out args line), and I get the same result either way. Here’s my code:
[code]//source and dest are folderitems to the source and destination folders
dim args() as String
dim rsyncpath as string
dim s as new shell
s.Execute(“which rsync”)
rsyncpath = s.Result.Trim
AuthorizationShell1.Reset()
AuthorizationShell1.SetUsernameAndPassword( “”, “” ) // Even if it’s blank
//args = Array("-rt","-vi","–progress","–exclude="".""",source.shellpath+"/",dest.shellpath)
args = Array("-rt","-vi","–progress","–exclude="".""",""""+source.nativepath+"/""",""""+dest.NativePath+"""")
if AuthorizationShell1.AuthorizeAndExecute(rsyncpath, args) then
// Shell is running now.
// Let’s start the poll timer and enable command input.
BringSelfToFront
elseif AuthorizationShell1.ErrorNumber <> 0 then
msgBox "Unknown error: " + str(AuthorizationShell1.ErrorNumber)
else
//msgBox “User cancelled”
end if[/code]
In the AuthorizationShell DataAvailable event, I just ReadAll and output it to a textarea, which is where I’m getting the output at the top of this post.
Any help would be appreciated if someone sees what I’m doing wrong. Thanks!