Can't move home folder to OneDrive folder

I hope this is a simple answer and I appreciated any assistance I can get. I’m trying to move a folder called data located in the user’s home folder. I need to move this to the employee’s OneDrive folder.

As a test, I can get the following to work (this will move the data folder to the Desktop):

set userName to short user name of (system info)
do shell script “mv /users/” & quoted form of userName & “/data /users/” & quoted form of userName & “/Desktop”

When I change Desktop in the above line to the path of the OneDrive folder (OneDrive - mycorp), it looks like this:

set userName to short user name of (system info)
do shell script “mv /users/” & quoted form of userName & “/data /users/” & quoted form of userName & “/OneDrive - mycorp”

I get the following error message saying
error “usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source … directory” number 64

I think the problem I’m having has to do with the spaces and the dash that are part of the OneDrive folder name. This name is created by default so I can’t change it.

Thanks, everyone.

Hi,

indeed the error reason are the space characters in “OneDrive - mycorp”

The solution is to wrap the whole paths in quoted form of.

set homeFolder to POSIX path of (path to home folder)
set source to homeFolder & "data"
set destination to homeFolder & "OneDrive - mycorp"
do shell script "mv " & quoted form of source & space & quoted form of destination

Your suggestion worked great!!! Thanks so much!!!