[
https://issues.apache.org/jira/browse/NET-324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867713#action_12867713
]
Kristof Neirynck commented on NET-324:
--------------------------------------
A friend of mine informed me it was working with his vsftpd server.
So I thought it might be a server related issue and tried another ftp server.
This didn't seem to change anything.
{noformat}
<ftp action="get" verbose="true"
server="${server}" userid="${userid}" password="${password}" remotedir=".">
<fileset dir="downloads" casesensitive="false"
includes="a/a.txt" />
</ftp>
{noformat}
Using IIS 7 ftp server
{noformat}
Unable to locate tools.jar. Expected to find it in
C:\PROGRA~1\Java\jre6\lib\tools.jar
Apache Ant version 1.8.1 compiled on April 30 2010
Trying the default build file: build.xml
Buildfile: C:\Projects\tests\ant\ftp\build.xml
Detected Java version: 1.6 in: C:\PROGRA~1\Java\jre6
Detected OS: Windows 7
parsing buildfile C:\Projects\tests\ant\ftp\build.xml with URI =
file:/C:/Projects/tests/ant/ftp/bui
ld.xml
Project base dir set to: C:\Projects\tests\ant\ftp
parsing buildfile
jar:file:/C:/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with
UR
I = jar:file:/C:/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
Build sequence for target(s) `example' is [example]
Complete build sequence is [example, ]
example:
[echo] should retrieve 1 files (a/a.txt)
[ftp] Opening FTP connection to example.dev
[ftp] connected
[ftp] logging in to FTP server
[ftp] login succeeded
[ftp] changing the remote directory to .
[ftp] getting files
remote system is case sensitive : false
[ftp] Hidden file \\a\a.txt assumed to not be a symlink.
[ftp] Hidden file \\a\a.txt assumed to not be a symlink.
[ftp] 0 files retrieved
[ftp] disconnecting
BUILD SUCCESSFUL
Total time: 0 seconds
Press any key to continue . . .
{noformat}
Using Filezilla
{noformat}
Unable to locate tools.jar. Expected to find it in
C:\PROGRA~1\Java\jre6\lib\tools.jar
Apache Ant version 1.8.1 compiled on April 30 2010
Trying the default build file: build.xml
Buildfile: C:\Projects\tests\ant\ftp\build.xml
Detected Java version: 1.6 in: C:\PROGRA~1\Java\jre6
Detected OS: Windows 7
parsing buildfile C:\Projects\tests\ant\ftp\build.xml with URI =
file:/C:/Projects/tests/ant/ftp/bui
ld.xml
Project base dir set to: C:\Projects\tests\ant\ftp
parsing buildfile
jar:file:/C:/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with
UR
I = jar:file:/C:/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml
from a zip file
Build sequence for target(s) `example' is [example]
Complete build sequence is [example, ]
example:
[echo] should retrieve 1 files (a/a.txt)
[ftp] Opening FTP connection to localhost
[ftp] connected
[ftp] logging in to FTP server
[ftp] login succeeded
[ftp] changing the remote directory to .
[ftp] getting files
remote system is case sensitive : false
[ftp] Hidden file \\a\a.txt assumed to not be a symlink.
[ftp] Hidden file \\a\a.txt assumed to not be a symlink.
[ftp] 0 files retrieved
[ftp] disconnecting
BUILD SUCCESSFUL
Total time: 0 seconds
Press any key to continue . . .
{noformat}
Filezilla allows me to see a rather detailed log:
{noformat}
FileZilla Server version 0.9.34 beta
Copyright 2001-2009 by Tim Kosse ([email protected])
Connecting to server...
Connected, waiting for authentication
Logged on
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> Connected, sending
welcome message...
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> 220-FileZilla
Server version 0.9.34 beta
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> 220-written by Tim
Kosse ([email protected])
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> 220 Please visit
http://sourceforge.net/projects/filezilla/
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> USER example
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> 331 Password
required for example
(000005) 14/05/2010 23:53:26 - (not logged in) (127.0.0.1)> PASS *******
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 230 Logged on
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> TYPE I
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 200 Type set to I
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD .
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> SYST
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 215 UNIX emulated by
FileZilla
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PORT 127,0,0,1,204,98
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 200 Port command successful
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> LIST
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 150 Opening data channel
for directory list.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 226 Transfer OK
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD A
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/A" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD /
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD .
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD /
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD a
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/a" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD //a
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/a" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/a" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PORT 127,0,0,1,204,99
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 200 Port command successful
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> LIST
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 150 Opening data channel
for directory list.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 226 Transfer OK
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD /
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PORT 127,0,0,1,204,100
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 200 Port command successful
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> LIST
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 150 Opening data channel
for directory list.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 226 Transfer OK
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD /
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> PWD
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 257 "/" is current
directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> CWD /
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 250 CWD successful. "/" is
current directory.
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> QUIT
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> 221 Goodbye
(000005) 14/05/2010 23:53:26 - example (127.0.0.1)> disconnected.
{noformat}
Using telnet I was able to see what the LIST command returned.
LIST
{noformat}
drwxr-xr-x 1 ftp ftp 0 May 07 18:40 a
drwxr-xr-x 1 ftp ftp 0 May 07 18:40 c
-r--r--r-- 1 ftp ftp 0 May 07 18:40 root1.txt
-r--r--r-- 1 ftp ftp 0 May 07 18:40 root2.txt
{noformat}
LIST /a
or
CWD a
LIST
{noformat}
-r--r--r-- 1 ftp ftp 0 May 07 18:40 a.txt
drwxr-xr-x 1 ftp ftp 0 May 07 18:41 b
{noformat}
I hope that is enough information.
> ant ftp doesn't download files in subdirectories when remotedir is empty or
> root folder
> ---------------------------------------------------------------------------------------
>
> Key: NET-324
> URL: https://issues.apache.org/jira/browse/NET-324
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Windows 7, 64bit, apache-ant-1.8.1, commons-net-2.0,
> jakarta-oro-2.0.8, FileZilla Server version 0.9.34 beta
> Reporter: Kristof Neirynck
> Priority: Minor
>
> I'm trying to download files in subdirectories from an ftp server with ant.
> The exact set of files is known. Some of them are in subdirectories. Ant only
> seems to download the ones in the root directory. It does work if I download
> all files without listing them.
> At first I thought I was doing something wrong so I posted a question on
> stackoverflow.
> http://stackoverflow.com/questions/2790570/ant-ftp-doesnt-download-files-in-subdirectories
> You can see my scriptdef workaround in the answers there.
> The first ftp action should do the exact same thing as the second. Instead I
> get "Hidden file \\a\a.txt assumed to not be a symlink."
> {code:title=build.xml}
> <?xml version="1.0" encoding="utf-8"?>
> <project name="example" default="example" basedir=".">
> <taskdef name="ftp"
> classname="org.apache.tools.ant.taskdefs.optional.net.FTP" />
> <target name="example">
> <!-- doesn't work -->
> <ftp action="get" verbose="true"
> server="localhost" userid="example" password="example"
> remotedir="">
> <fileset dir="downloads" casesensitive="false"
> includes="a/a.txt,a/b/ab.txt,c/c.txt" />
> </ftp>
> <!-- works (but requires multiple ftp tasks) -->
> <ftp action="get" verbose="true"
> server="localhost" userid="example" password="example"
> remotedir="a">
> <fileset dir="downloads" casesensitive="false"
> includes="a.txt,b/ab.txt" />
> </ftp>
> <ftp action="get" verbose="true"
> server="localhost" userid="example" password="example"
> remotedir="c">
> <fileset dir="downloads" casesensitive="false"
> includes="c.txt" />
> </ftp>
> </target>
> </project>
> {code}
> {code:title=build-with-workaround.xml}
> <?xml version="1.0" encoding="utf-8"?>
> <project name="example" default="example" basedir=".">
> <taskdef name="ftp"
> classname="org.apache.tools.ant.taskdefs.optional.net.FTP" />
> <target name="example">
> <scriptdef name="my-ftp-get" language="javascript">
> <attribute name="server"/>
> <attribute name="userid"/>
> <attribute name="password"/>
> <attribute name="remotedir"/>
> <attribute name="fileset_dir"/>
> <attribute name="fileset_includes"/>
> <![CDATA[
> importClass(java.io.File);
> importClass(org.apache.tools.ant.taskdefs.optional.net.FTP);
> var local_basedir = "" + attributes.get("fileset_dir") + "/";
> var original_includes = "" + attributes.get("fileset_includes");
> var remotedir = "" + attributes.get("remotedir");
> local_basedir = local_basedir.replace(/\\/g, "/");
> original_includes = original_includes.replace(/\\/g, "/");
> remotedir = remotedir.replace(/\\/g, "/");
> var includes_arr = original_includes.split(",");
> var clean_includes = {};
> for (var i = 0; i < includes_arr.length; i++) {
> var directory = "/";
> var filename = includes_arr[i];
> var split_include = includes_arr[i].split("/");
> if (split_include.length > 1) {
> directory = split_include[0] + "/";
> filename = includes_arr[i].substring(directory.length);
> }
> if (!clean_includes.hasOwnProperty(directory)) {
> clean_includes[directory] = [];
> }
> clean_includes[directory].push(filename);
> }
> var get_files = new FTP.Action();
> get_files.setValue("get");
> for (var path in clean_includes) {
> var current_clean_includes = clean_includes[path].join(",");
> var fileset = project.createDataType("fileset");
> var ftp = self.project.createTask("ftp");
> ftp.setAction(get_files);
> ftp.setServer(attributes.get("server"));
> ftp.setUserid(attributes.get("userid"));
> ftp.setPassword(attributes.get("password"));
> ftp.setRemotedir(remotedir + path);
> fileset.setDir(new File(local_basedir + path));
> fileset.setIncludes(current_clean_includes);
> ftp.addFileset(fileset);
> ftp.perform();
> }
> ]]>
> </scriptdef>
> <my-ftp-get
> server="localhost" userid="example" password="example"
> remotedir=""
> fileset_dir="downloads" casesensitive="false"
> fileset_includes="a/a.txt,a/b/ab.txt,c/c.txt">
> </my-ftp-get>
> </target>
> </project>
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.