If the file is locked because of a process keeping an handle on it, it can be as simple as killing that process, and relaunching the update through the CCRC Navigator View
Refresh > Update from Repository
Regarding a ""com.ibm.rational.clearcase.remote_core.copyarea.CopyAreaLockedException
" error message, the IBM help page mentions:
The Copy Area Locked prompt appears when ClearCase encounters a
copyarea.lck
file after a user has attempted to rebase or deliver from a ClearCase Remote Client that resides on the same machine as the ClearCase native client.
So I suspect that your script need to find and remove that copyarea.lck
file, in order to proceed.
But I would also recommend to check why (or if) there is a pending rebase or deliver in progress.
It would be best if that "rebase or deliver" was fully completed before your script runs.
The OP jingxw adds in the comments:
The progress is pending because of last progress is fail due to a timeout or manually quit. So the lock is expected.