Copying and Moving Files Using .NET
A couple of little functions to do some grunt-work...
⍝ Copy a file
⎕IO ⎕ML ⎕USING←0
CopyFile 'c:\dick\temp\old.txt' 'c:\dick\temp\new.txt'
∇ z←MoveFile(from to);⎕IO;⎕ML;⎕USING;⎕TRAP
⍝ Move a file
⎕IO ⎕ML ⎕USING←0 3('System' 'System.IO')
File.Move from to
MoveFile 'c:\dick\temp\old.txt' 'c:\dick\temp\new.txt'
Page created 3 March
- Attempting to define CopyFile as a d-fn weren't successful (some time ago)
- Note the 1 (success) and 0 (fail) result convention, which seems a lot more APLlike than the reverse
also the implicit acceptance of Microsoft's "overwrite/replace"
argument, you might like to change CopyFile or take care of possible
overwrites before use
- Logically, moving a file is not much different from renaming it - but maybe it's helpful to separate the concepts.