www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - FTP LS

reply Anonymouse <zorael gmail.com> writes:
Before I go on duplicating effort, does anyone have anything that 
can access FTP beyond PUT and GET?

I need to read file information from a NAS so I know if I should 
upload a file or not. `dlang-requests` has `Request.post` and 
`Request.get`, but seemingly no way to LS.
May 14 2022
next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
Phobos curl wrapper may be an option:

https://dlang.org/phobos/std_net_curl.html#.FTP
May 14 2022
prev sibling next sibling parent reply ikod <igor.khasilev gmail.com> writes:
On Saturday, 14 May 2022 at 08:42:46 UTC, Anonymouse wrote:
 Before I go on duplicating effort, does anyone have anything 
 that can access FTP beyond PUT and GET?

 I need to read file information from a NAS so I know if I 
 should upload a file or not. `dlang-requests` has 
 `Request.post` and `Request.get`, but seemingly no way to LS.
It should. Maybe get ftp://path/ . Will check a bit later.
May 14 2022
parent ikod <igor.khasilev gmail.com> writes:
On Saturday, 14 May 2022 at 10:17:14 UTC, ikod wrote:
 On Saturday, 14 May 2022 at 08:42:46 UTC, Anonymouse wrote:
 Before I go on duplicating effort, does anyone have anything 
 that can access FTP beyond PUT and GET?

 I need to read file information from a NAS so I know if I 
 should upload a file or not. `dlang-requests` has 
 `Request.post` and `Request.get`, but seemingly no way to LS.
It should. Maybe get ftp://path/ . Will check a bit later.
Yes, it should. If you get("ftp://hostname/path/") it will try to download directory as file and fail. After that it will try to make NLST and will return directory listing. Please note - AFAIK you will receive only names, no size or other file attributes. -- Support πŸ‡ΊπŸ‡¦!
May 14 2022
prev sibling next sibling parent ikod <igor.khasilev gmail.com> writes:
On Saturday, 14 May 2022 at 08:42:46 UTC, Anonymouse wrote:
 Before I go on duplicating effort, does anyone have anything 
 that can access FTP beyond PUT and GET?

 I need to read file information from a NAS so I know if I 
 should upload a file or not. `dlang-requests` has 
 `Request.post` and `Request.get`, but seemingly no way to LS.
or I can implement this with http method HEAD. If this is ok - please post issue on github repo. Thanks! -- Support πŸ‡ΊπŸ‡¦!
May 14 2022
prev sibling parent reply ikod <igor.khasilev gmail.com> writes:
On Saturday, 14 May 2022 at 08:42:46 UTC, Anonymouse wrote:
 Before I go on duplicating effort, does anyone have anything 
 that can access FTP beyond PUT and GET?

 I need to read file information from a NAS so I know if I 
 should upload a file or not. `dlang-requests` has 
 `Request.post` and `Request.get`, but seemingly no way to LS.
Added LIST command in v2.0.8 ``` ᐅ cat source/app.d import std.stdio; import requests; void main() { auto rq = Request(); auto rs = rq.execute("LIST", "ftp://ftp.iij.ad.jp/pub/FreeBSD/"); writeln(rs.responseBody); } /tmp/ttt ᐅ dub run Running ttt -rw-rw-r-- 1 ftp ftp 4259 May 07 2015 README.TXT -rw-rw-r-- 1 ftp ftp 35 May 12 09:00 TIMESTAMP drwxrwxr-x 9 ftp ftp 169 Oct 05 2015 development -rw-r--r-- 1 ftp ftp 2871 May 11 10:00 dir.sizes drwxrwxr-x 22 ftp ftp 8192 May 09 23:00 doc drwxrwxr-x 6 ftp ftp 92 Jan 10 21:38 ports drwxrwxr-x 12 ftp ftp 237 Feb 06 2021 releases drwxrwxr-x 12 ftp ftp 237 May 05 18:00 snapshots ``` -- Support πŸ‡ΊπŸ‡¦!
May 15 2022
parent Anonymouse <zorael gmail.com> writes:
On Sunday, 15 May 2022 at 19:13:10 UTC, ikod wrote:
 Added LIST command in v2.0.8
Thanks!
May 15 2022