Author Topic: create directory with ftp?  (Read 1762 times)

0 Members and 1 Guest are viewing this topic.

Offline alanlehman

  • Member
  • *
  • Posts: 11
create directory with ftp?
« on: June 25, 2017, 02:52:49 PM »
I need to be able to create a directory for each day's data on my web server. I'm using ftp push to upload data every 5 minutes but it won't create directories.

Path (file): %Y%m%d/WxData-%Y%m%d-%H%M.csv
only reports "directory not found"

I tried using a script to do this, but there is no ftp or curl client installed (that I could find anyway).

Thanks,
Alan
« Last Edit: June 25, 2017, 03:09:00 PM by alanlehman »

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 196
Re: create directory with ftp?
« Reply #1 on: June 26, 2017, 02:50:27 PM »
The meteobridge (ver 3.2) has a 'ncftpput' command available at the command line level. I have used it in the past to do some file transfers. The documentation on ncftpput (http://www.ncftp.com/ncftp/doc/ncftpput.html) defines a -R option to transfer a compete directory structure.

It looks like you should be able to make it work in your script.

Offline alanlehman

  • Member
  • *
  • Posts: 11
Re: create directory with ftp?
« Reply #2 on: June 28, 2017, 12:05:11 AM »
Thanks.
Do you know if there is a way to use strftime parameters as input?
I wanted to do something like this to create directories named YYYYmmdd.

ncftpput -u xxx -p xxx -m xxx.org %Y%m%d filename

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 196
Re: create directory with ftp?
« Reply #3 on: June 28, 2017, 08:50:25 AM »


ncftpput -u xxx -p xxx -m xxx.org %Y%m%d filename

ncftpput -u xxx -p xxx -m xxx.org `date +%Y%m%d` filename

should execute as

ncftpput -u xxx -p xxx -m xxx.org 20170628 filename

Offline alanlehman

  • Member
  • *
  • Posts: 11
Re: create directory with ftp?
« Reply #4 on: June 28, 2017, 08:15:27 PM »
Back-quote. Duh. Thank you!