Re: [lftp] Recursive directory list without ls -R option?
Hi Alexander, Thank you for the quick patch, unfortunately I've not been successful in compiling lftp. I'm trying to compile it for cygwin for now (ultimately I hope to be able to cross compile it for my Synology NAS server) After finding loads of missing libraries etc. I've now successfully ran ./autogen.sh however, when I run make I get the following error: after load more output: mv -f .deps/ftpclass.Tpo .deps/ftpclass.Plo /bin/sh ../libtool --silent --tag=CXX --mode=compile gcc -DHAVE_CONFIG_H -I. -I../lib -I../lib -I../trio -I/usr/include/p11-kit-1 -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -MT FtpListInfo.lo -MD -MP -MF .deps/FtpListInfo.Tpo -c -o FtpListInfo.lo FtpListInfo.cc mv -f .deps/FtpListInfo.Tpo .deps/FtpListInfo.Plo /bin/sh ../libtool --silent --tag=CXX --mode=compile gcc -DHAVE_CONFIG_H -I. -I../lib -I../lib -I../trio -I/usr/include/p11-kit-1 -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -MT FtpDirList.lo -MD -MP -MF .deps/FtpDirList.Tpo -c -o FtpDirList.lo FtpDirList.cc mv -f .deps/FtpDirList.Tpo .deps/FtpDirList.Plo /bin/sh ../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../lib -I../lib -I../trio -I/usr/include/p11-kit-1 -g -O2 -Wall -MT ftp-opie.lo -MD -MP -MF .deps/ftp-opie.Tpo -c -o ftp-opie.lo ftp-opie.c mv -f .deps/ftp-opie.Tpo .deps/ftp-opie.Plo /bin/sh ../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../lib -I../lib -I../trio -I/usr/include/p11-kit-1 -g -O2 -Wall -MT netkey.lo -MD -MP -MF .deps/netkey.Tpo -c -o netkey.lo netkey.c netkey.c:292:2: warning: missing braces around initializer [-Wmissing-braces] { 3, 2, 9, 8, 18, 8, 27, 32, 33, 2, 42, 16, 48, 8, 65, 16, ^ netkey.c:292:2: warning: (near initialization for 'keyexpand[0][0]') [-Wmissing-braces] mv -f .deps/netkey.Tpo .deps/netkey.Plo /bin/sh ../libtool --silent --tag=CXX --mode=compile gcc -DHAVE_CONFIG_H -I. -I../lib -I../lib -I../trio -I/usr/include/p11-kit-1 -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -MT FileCopyFtp.lo -MD -MP -MF .deps/FileCopyFtp.Tpo -c -o FileCopyFtp.lo FileCopyFtp.cc mv -f .deps/FileCopyFtp.Tpo .deps/FileCopyFtp.Plo /bin/sh ../libtool --silent --tag=CXX --mode=link gcc -O2 -Wall -Wwrite-strings -Woverloaded-virtual -fno-exceptions -fno-rtti -fno-implement-inlines -module -avoid-version -rpath /usr/local/lib/lftp/4.4.11 -s -o proto-ftp.la ftpclass.lo FtpListInfo.lo FtpDirList.lo ftp-opie.lo netkey.lo FileCopyFtp.lo -L/usr/local/lib/lftp/4.4.11 liblftp-network.la -lsupc++ libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libgnutls.la' seems to be moved libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libintl.la' seems to be moved libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libiconv.la' seems to be moved libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libgmp.la' seems to be moved libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libtasn1.la' seems to be moved libtool: link: warning: `/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../libp11-kit.la' seems to be moved libtool: link: warning: undefined symbols not allowed in i686-pc-cygwin shared libraries /usr/bin/sed: can't read Kampf/programming/lftp2/src/liblftp-network.la: No such file or directory libtool: link: `Kampf/programming/lftp2/src/liblftp-network.la' is not a valid libtool archive Makefile:1911: recipe for target 'proto-ftp.la' failed make[1]: *** [proto-ftp.la] Error 1 make[1]: Leaving directory '/home/Marijn Kampf/programming/lftp2/src' Makefile:1579: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1 anyone any ideas what is going wrong? Cheers, Marijn. On 15/11/2013 11:08, Alexander V. Lukyanov wrote: On Thu, Nov 14, 2013 at 12:47:25PM +, Marijn Kampf wrote: I'm trying to get a recursive list of all files uploaded to an SFTP server including file size and date. Unfortunately the server doesn't support the ls -R option. I can get an overview of file size with: du -ba Is there a way to add the file creation date to the above command in lftp? This patch adds "find -l" command option. HTH. -- Alexander. ___ lftp mailing list lftp@uniyar.ac.ru http://univ.uniyar.ac.ru/mailman/listinfo/lftp
Re: [lftp] Recursive directory list without ls -R option?
On Thu, Nov 14, 2013 at 12:47:25PM +, Marijn Kampf wrote: > I'm trying to get a recursive list of all files uploaded to an SFTP > server including file size and date. Unfortunately the server > doesn't support the ls -R option. > > I can get an overview of file size with: > du -ba > > Is there a way to add the file creation date to the above command in lftp? This patch adds "find -l" command option. HTH. -- Alexander. diff --git a/doc/lftp.1 b/doc/lftp.1 index f81ad01..0ad75be 100644 --- a/doc/lftp.1 +++ b/doc/lftp.1 @@ -41,7 +41,7 @@ .fi .in .. -.TH lftp 1 "08 Oct 2013" +.TH lftp 1 "15 Nov 2013" .SH NAME lftp \- Sophisticated file transfer program .SH SYNTAX @@ -58,7 +58,7 @@ lftp \- Sophisticated file transfer program .B lftp \-\-help .SH VERSION -This man page documents lftp version 4.4.10. +This man page documents lftp version 4.4.12. .SH "DESCRIPTION" \fBlftp\fR is a file transfer program that allows sophisticated ftp, http @@ -261,12 +261,19 @@ command is used. .PP Alias for `wait'. -.B find -.RI " [" directory "] " +.BR find " [" OPTS "] " \fIdirectory...\fP .PP List files in the directory (current directory by default) recursively. This can help with servers lacking ls \-R support. You can redirect output -of this command. +of this command. Options: +.Sp +.in +0.5i +.TS +l1 l lx . +\-d \fIMD\fP, \-\-max\-depth=\fIMD\fP specify maximum scan depth +\-l, \-\-listuse long listing format +.TE +.PP .BR ftpcopy .PP diff --git a/src/FileSet.h b/src/FileSet.h index 51ccdf1..a2d69ae 100644 --- a/src/FileSet.h +++ b/src/FileSet.h @@ -89,6 +89,7 @@ public: ~FileInfo(); void SetName(const char *n) { name.set(n); def(NAME); } + void SetName(const xstring& n) { name.set(n); def(NAME); } void SetUser(const char *n); void SetGroup(const char *n); void LocalFile(const char *name, bool follow_symlinks); diff --git a/src/FindJob.cc b/src/FindJob.cc index b42f0b0..8275b0d 100644 --- a/src/FindJob.cc +++ b/src/FindJob.cc @@ -360,24 +360,36 @@ FinderJob::prf_res FinderJob_List::ProcessFile(const char *d,const FileInfo *fi) fg_data=buf->GetFgData(fg); if(buf->Size()>0x1) return PRF_LATER; + + xstring path_to_show; if(ProcessingURL()) { FileAccess::Path old_cwd=session->GetCwd(); session->SetCwd(init_dir); session->Chdir(dir_file(d,fi->name),false); - buf->Put(session->GetConnectURL()); + path_to_show.set(session->GetConnectURL()); session->SetCwd(old_cwd); } else - buf->Put(dir_file(d,fi->name)); + path_to_show.set(dir_file(d,fi->name)); if((fi->defined&fi->TYPE) && fi->filetype==fi->DIRECTORY && strcmp(fi->name,"/")) - buf->Put("/"); + path_to_show.append('/'); + + if(long_listing) { + FileInfo n(*fi); + n.SetName(path_to_show); + n.MakeLongName(); + buf->Put(n.longname); + } else { + buf->Put(path_to_show); + } + buf->Put("\n"); return FinderJob::ProcessFile(d,fi); } FinderJob_List::FinderJob_List(FileAccess *s,ArgV *a,FDStream *o) - : FinderJob(s), args(a) + : FinderJob(s), args(a), long_listing(false) { if(o) buf=new IOBufferFDStream(o,IOBuffer::PUT); diff --git a/src/FindJob.h b/src/FindJob.h index a6767a3..6d88b49 100644 --- a/src/FindJob.h +++ b/src/FindJob.h @@ -117,12 +117,14 @@ class FinderJob_List : public FinderJob { SMTaskRef buf; Ref args; + bool long_listing; protected: prf_res ProcessFile(const char *d,const FileInfo *fi); void Finish(); public: FinderJob_List(FileAccess *s,ArgV *a,FDStream *o); + void DoLongListing(bool yes=true) { long_listing=yes; } int Done() { return FinderJob::Done() && buf->Done(); } }; diff --git a/src/commands.cc b/src/commands.cc index 6c24185..d70a7bc 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2850,13 +2850,15 @@ CMD(find) static struct option find_options[]= { {"maxdepth",required_argument,0,'d'}, + {"ls",no_argument,0,'l'}, {0,0,0,0} }; int opt; int maxdepth = -1; + bool long_listing=false; const char *op=args->a0(); - while((opt=args->getopt_long("+d:",find_options))!=EOF) + while((opt=args->getopt_long("+d:l",find_options))!=EOF) { switch(opt) { @@ -2868,6 +2870,9 @@ CMD(find) } maxdepth = atoi(optarg); break; + case 'l': +long_listing=true; +break; case '?': eprintf(_("Usage: %s [-d #] dir\n"),op); return 0; @@ -2878,6 +2883,7 @@ CMD(find) args->Append("."); FinderJob_List *j=new class FinderJob_List(session->Clone(),args.borrow(),output.borrow()); j->set_maxdepth(maxdepth); + j->DoLongListing(long_listing); return j; } ___ lftp mailing list lftp@uniyar.ac.ru http://univ.uniyar.ac.ru/mailman/listinfo/lftp
[lftp] Recursive directory list without ls -R option?
Hello, I'm trying to get a recursive list of all files uploaded to an SFTP server including file size and date. Unfortunately the server doesn't support the ls -R option. I can get an overview of file size with: du -ba Is there a way to add the file creation date to the above command in lftp? Thank you, Marijn ___ lftp mailing list lftp@uniyar.ac.ru http://univ.uniyar.ac.ru/mailman/listinfo/lftp