[Newbies] moving files on Windows

Waldemar Schwan waldemar.schwan at googlemail.com
Wed Sep 3 07:37:39 UTC 2008


Hello everyone.

Normaly I'm developing on MacOS 10.5. As I tryed to run my code on a  
Windows Vista deleting a file throws me an

CannotDeleteFileException: Coud not delete the old version of file D: 
\waldemar\test\movingDestionation\moveMe.txt

Because the error don't tells me why the file can't be deletet I'm  
completly stumped. The file is writeable.

What I'm trying to do is to move a file from one folder to another. To  
acomplish that I create a readOnlyFileStream on the src-file an force  
the destinationdirectory to create a new file named like the src-file.  
After that I use FileDirectory>>copyFile: to: .

moveLocalFile: aCBFile3DLocal toMountain: aCBMountain
	| srcDir destDir srcFile destFile |
	srcDir := aCBFile3DLocal file directory fileDirectory.
	destDir := FileDirectory on: aCBMountain path.

	srcFile := srcDir readOnlyFileNamed: aCBFile3DLocal file name.
	srcFile binary.
	destFile := destDir forceNewFileNamed: aCBFile3DLocal file name.
	destFile binary.

	srcDir copyFile: srcFile toFile: destFile.
	srcDir deleteFileNamed:  aCBFile3DLocal file name.


Again: This code works on Mac but don't on Windows (Vista) allsow in  
compatibility mode.
I hope someone can give me a hint.



Best regards.
	Waldemar


More information about the Beginners mailing list