Hi, I think the problem is using 'aPath/cat.jpg' as a single string (= as a single component of the path). This: path1 := FileSystem root / 'a/b/c.txt'. is different to: path2 := FileSystem root / 'a' / 'b' / 'c.txt'. Compare the results when I ask for the parent directory: path1 parent "-> File @ /" path2 parent "-> File @ /a/b" When renaming, the #renameTo: method takes the #parent directory as the base for the target filename. Therefore: (FileSystem root / 'a/b/c.txt') renameTo: 'my.txt'. will try to create file: FileSystem root / 'my.txt' Whereas: (FileSystem root / 'a' / 'b' / 'c.txt') renameTo: 'my.txt'. will try to create file: FileSystem root / 'a' / 'b' / 'my.txt' And in your case, FileSystem root is probably not writable. Michal On 18.4.2016 10:31, Valentin Ryckewaert wrote:
Hi everyone,
I'm trying to rename files with this code but it doesn't work, pharo is saying me "PrimitiveFailed" I tried lots of things and I'm not finding how I can rename this file, someone has an idea please?
| myFile | myFile := FileSystem root / 'aPath/cat.jpg'. myFile renameTo:'cats.jpg'
Valentin