fs_dir_copyΒΆ
fs_dir_copy :: fn (src: string, dest: string, opt: *FSCopyOpt, filter: FSDirScanFilterFn) (_0: s64, _1: Error)
Copy from src path to dest path with specified opt options and return count of processed files or error.
Example:
#import "std/fs"
main :: fn () s32 {
// Copy options
opt: FSCopyOpt;
// Create destination directory if not exist.
opt.recursive = true;
// Override all existing entries.
opt.override = true;
// Copy content of 'foo' into 'bar'
c, err :: fs_dir_copy("foo", "bar", &opt, &fn (item: *FSInfo) bool {
// Filter only txt files
if string_compare(fs_get_extension(item.name), "txt") { return true; }
return false;
});
if !is_ok(err) { print("%\n", err); }
else { print("Copied % files!\n", c); }
return 0;
}
Declared in: fs.bl