Jump to content

SCCopy not working?


This topic is 4483 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

I am trying to get SCCopy to work.

I have version 2.792 installed on my mac-mini server. I have version 2.852 companion plugin on the filemaker client. Base URL is set on file opening.

I am trying to copy a document from one part of the supercontainer directory to another part of the supercontainer directory.

I can achieve the desired result using SCDownload followed by SCSetContainer (using the $download result), but I can't get the SCCopy to work using the same filepaths.

EG

Set Variable[$download = SCDownload("supercontainer_foldername")]

Set Variable[$upload = SCSetContainer("supercontainer_newlocation"; $download)]

The above works but below doesn't:

Set Variable[$copy = SCCopy("supercontainer_foldername"; "supercontainer_newlocation")]

The Error thrown up is "old file did not copy, make sure you have supercontainer server 1.73 or higher"

Is it a path problem? Does SCCopy require different paths?

Any help appreciated!!

Cheers

Guy

Link to comment
Share on other sites

Hey Guy,

Just ran a test using SCCopy and it seemed to work fine for me. SCCopy does not return a file path after the function call, instead it returns a 1 or ERROR.

A sample usage of SCCopy() would be:

http://localhost:8020/SuperContainer/Files/EmployeeDB/Employee0002/Document/Document03402" for instance, your folderPath may look similar to:


Set Variable [$copy; Value: SCCopy( "/SuperContainerPath/to/My/File" ; "/SuperContainerPath/to/My/File" )]

If [$copy = "ERROR"]

      Show Custom Dialog ["Error" ; "Copy failed: " & SCLastError]

End If





** where "SuperContainerPath" is the "folderPath" as required by all SC Companion plug-in functions. If you had a file located at:



"
"/EmployeeDB/Employee" & Employee::ID & "/Document/Document" & Document_tbl::ID 




while your SCCopy() function call would be:




SCCopy( "/EmployeeDB/Employee" & Employee::ID & "/Document/Document" & Document_tbl::ID ; "/EmployeeDB/Employee" & Employee::ID & "/destination/folderPath" )

I hope this helps. If you have any additional questions or need clarification on this, please do not hesitate to contact me directly by any of the means below!

Regards,

Link to comment
Share on other sites

Thanks for the explanation!

That is how I thought it should work... unfortunately I can't get it to work like that.

Using SCDownload followed by SCSetContainer I can get the desired result of effectively copying a file from part of the SC directory to a new part (but it would be much nicer to just copy rather than download to local machine then reupload to new location).

Using the exact same paths for SCCopy it does not work (returns ERROR, as initial post)- which I find very confusing!

I am happy with my file paths because they work using other SC function just fine.

Any other ideas as to what might be wrong?

Out of interest, if I SCCopy a file to an existing folder in the SC directory - no error is thrown up (returns 1), however the file-to-copy has not overwritten the pre-existing file in the destination folder...(there has been no change)

Thanks

Guy

Link to comment
Share on other sites

Hey Guy,

I read through the code a bit and that error is thrown when a file does not exist in the folderPath you are trying to pass in. I am not trying to imply that the code is 100% perfect (heh, there could be bugs here), but I would ask that you verify that the folderPath you are trying to copy from has a valid file in the directory. If so, it may be best for you and I to connect over a screen sharing session so I can see what's going on.

Like I said, I tried this locally and was able to successfully copy a file. Let me know if you want to schedule a time to connect over Skype or Screen sharing.

Regards,

Link to comment
Share on other sites

  • 2 weeks later...

I'm having the same problem and getting the same error.

My paths seem to work with other functions such as SCMove and SCDelete but not SCCopy for some reason.

I have set the base URL to

SCSetBaseURL("http://localhost:8020/SuperContainer/Files" )

Then I want to copy a file from this path

Email_Attachments/146163/1/FSH_12-LOB-0108_DE_8x105.pdf

to this path

Email_Attachments/146164/1/FSH_12-LOB-0108_DE_8x105.pdf

NOTE: the only difference is the ID number in the path

So I have tried

SCCopy(Email_Attachments/146163/1/FSH.pdf ; Email_Attachments/146164/1/FSH.pdf)

SCCopy(/Email_Attachments/146163/1/FSH.pdf ; /Email_Attachments/146164/1/FSH.pdf)

This is all on the same supercontainer server.

Link to comment
Share on other sites

Hey Charlie,

SCCopy(/Email_Attachments/146163/1/FSH.pdf ; /Email_Attachments/146164/1/FSH.pdf)

Are you passing this as string arguments? SCCopy( "/Email_Attachments/146163/1/FSH.pdf" ; "/Email_Attachments/146164/1/FSH.pdf" )? Also, these folder paths are definitely not recommended -- more specifically, the full path and file name are not recommended in SuperContainer folderPaths, as they can cause problems. Given this is your folderPath, your file would be located at:

"/Email_Attachments/146163/1/FSH.pdf/FSH.pdf"

which may not (or may) be what you'd want, however I would not suggest it as if you were to change the file located in ""/Email_Attachments/146163/1/FSH.pdf" to, say myImage.jpg, your file path would be:

"/Email_Attachments/146163/1/FSH.pdf/myImage.jpg"

which is probably not what you would want in the end. Also, is there a particular error message you are getting when calling this SCCopy function (after using SCLastError)? Another question, is this in fact the folderPath you are wanting to point to -- or, is the file actually located in the "1/" directory -- in which case the SCCopy call would look similar to:

SCCopy("/Email_Attachments/146163/1/" ; "/Email_Attachments/146164/1/" )

Looking forward to hearing from you,

Link to comment
Share on other sites

This topic is 4483 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.