Moving files with ObjectScript?

933 views
Skip to first unread message

icargill

unread,
Feb 7, 2013, 1:35:05 PM2/7/13
to intersystems...@googlegroups.com
I'm just wondering if I'm missing something obvious...
 
I process some files, and at the end need to move them into an archive folder.  At the moment, I'm doing it with
 
  Set res=##class(%Library.File).CopyFile(FileFrom,FileTo)
  Set res=##class(%Library.File).Delete(FileFrom)
which works, but probably isn't the most efficient for large files moving to another folder on the same volume.
I was hoping for something like
 
  Set res=##class(%Library.File).MoveFile(FileFrom,FileTo)
but can't see anything listed in the class docs, etc. 
I'm on Windows, and could do a $ZF(-1,) command  I suppose, but I'd prefer to move forwards, not backwards! :-)
 
 

Keith Avery

unread,
Feb 7, 2013, 1:37:29 PM2/7/13
to intersystems...@googlegroups.com

Use the Rename() method in the %File class.

 

-Keith

--
--
Caché, Ensemble, DeepSee
 
---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



The information contained in this email may be confidential and/or may be covered under the Privacy Act, 5 USC 552(a), and/or the Health Insurance Portability and Accountability Act (PL 104-191) and its various implementing regulations and must be protected in accordance with those provisions.. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please contact the sender by reply email and destroy all copies of the original message. To contact our email administrator directly, send an email message to help...@medsphere.com. Thank you.

icargill

unread,
Feb 7, 2013, 2:40:02 PM2/7/13
to intersystems...@googlegroups.com
That does it. Thanks.
Simple, but not obvious. :-( 

Mack Altman III

unread,
Aug 19, 2014, 5:50:24 PM8/19/14
to intersystems...@googlegroups.com
I believe they utilize rename as this has been used in several systems for years prior. I know coming from a Linux background I picked up on this quickly.
Reply all
Reply to author
Forward
0 new messages