Copy file using:
file.copy (file.frompath, file.inpath, true);
But if it comes across a path with a non-existent folder, let’s say
file.copy (@ "f: \ test \ text.txt", @ "f: \ test \ text .txt ", True);
(on the disk F, there is no such folder), then an exception is caused. How can I deal with it and is there another way to copy files? Or you need to manually create folders … I don’t want somehow.
Answer 1, Authority 100%
You need to create folder structure before copying.
directory.createdirectory (path.getdirectoryname (file.inpath));
File.copy (file.frompath, file.inpath, true);