This shows you the differences between two versions of the page.
— | sdk:scripts:transfer-file [2015/05/05 15:04] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SDK Script transfer-file.are ====== | ||
+ | <code c transfer-file.are> | ||
+ | /* DESC: This scripts archives a remote file | ||
+ | * Copyright (C) 2015 NetModule AG, Switzerland | ||
+ | */ | ||
+ | |||
+ | usr = ""; | ||
+ | pwd = ""; | ||
+ | url = " | ||
+ | source = "/ | ||
+ | |||
+ | ret = nb_transfer_get(usr, | ||
+ | if (ret != 0 || !file_exists(source)) { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | size = file_size(source); | ||
+ | if (size <= 0) { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | modified = gmtime(file_mtime(source)); | ||
+ | suffix = strftime(" | ||
+ | dest = sprintf(" | ||
+ | |||
+ | written = file_copy(source, | ||
+ | if (written < 0) { | ||
+ | printf(" | ||
+ | unlink(source); | ||
+ | exit(1); | ||
+ | } | ||
+ | |||
+ | printf(" | ||
+ | unlink(source); | ||
+ | |||
+ | exit(0); | ||
+ | </ | ||