Page 1 of 1

creation of ftp folder with month and year

Posted: Sat 28 Nov 2020 7:26 pm
by Tigro11
I wanted to save the file noaa.txt on ftp with the creation of the \ year \ month \ 2020_11_noaa.txt folder
Image

Re: creation of ftp folder with month and year

Posted: Sat 28 Nov 2020 11:00 pm
by mcrossley
Sorry, Cumulus doesn't support that. I think you would have to call an external EOD script to do it and disable the automatic upload in Cumulus.

Re: creation of ftp folder with month and year

Posted: Sun 29 Nov 2020 8:49 am
by Tigro11
perfect,I then use this php to rename the files and copy it to the exact folder.

<?
// converto automaticamente NOAAYR.TXT e NOAAMO.TXT generati da WeatherLink per statistiche noaa GraphWeather.
// con un cronjob https://www.setcronjob.com/
set_time_limit(300);

//crea cartella copia e rinomina noaa anno

$a=time();
$m=date('m',$a);
$Y=date('Y',$a);

$noaa_anno=$Y;

// scrivo cartella noaa anno

if (!is_dir($folder)) {
mkdir("$noaa_anno",0700);
}

// copio e rinomino noaa anno

$originale="../NOAAYR.TXT";
$copia="NOAAYR.TXT";
//copy($originale,$copia);
rename('NOAAYR.TXT',$noaa_anno.'/'.$Y.'_NOAA.txt');

//crea cartella copia e rinomina noaa mese

$a=time();
$m=date('m',$a);
$Y=date('Y',$a);

$noaa_mese_2=$m;
$noaa_anno=$Y;

// scrivo la cartella noaa mese
//$noaa_mese_2/
//nella cartella anno
// $noaa_anno/

if (!is_dir($folder)) {
mkdir("$noaa_anno/$noaa_mese_2/",0700);
}

// copio e rinomino noaa mese

$originale="../NOAAMO.TXT"; // file nella cartella originale
$copia="NOAAMO.TXT"; // file nella cartella
//copy($originale,$copia); // copia originale > destinazione

// rinomino file NOAAMO.TXT
// virgola per separare ,
//(cartella anno) $noaa_anno
// slasch .'/'.
//(cartella mese) $noaa_mese_2
// slasch .'/'.
// anno $Y
// trattino o altro '_'
// mese $m

rename('NOAAMO.TXT',$noaa_anno.'/'.$noaa_mese_2.'/'.$Y.'_'.$m.'_NOAA.txt');

?>