> On 22 May 2016, at 18:05, Robert Kuszinger <kuszin...@giscom.hu> wrote:
> 
> Hello!

Hi!


> I'm new to this list.
> After years of mixed awk-bash scripting I came to the question:

:)


> 
> "Why don't I script in smalltalk since I'm doing everything else in
> Smalltak?"
> 
> (Pharo, formerly VA)
> 
> After hours of fighting I'm still not able to move/copy file sytem files
> (this is Linux).
> 
> *Are there classes for that?*

The File class binds a lot of the POSIX API. Let's start with "move" here.


st> 'oldName' asFile renameTo: 'newFile'

will move/rename 'oldName' to 'newFile'

For copying I think you would need to do something like:


| outStr |
outStr := 'newFileName' asFile writeStream.
'oldFile' asFile readStream nextPutAllOn: outStr.
outStr close.

A writeStreamDo: might make sense to have the close be called as well. In File 
we have bindings for fsync and fdatasync as well in case you really want to 
control the consistency.


holger
_______________________________________________
help-smalltalk mailing list
help-smalltalk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to