Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-31-2009, 03:15 AM   #1
Registered: Feb 2009
Posts: 47

Rep: Reputation: 15
FTP dir command in LINUX

Dear all,
I am getting different output of FTP commands in linux and unix.
We are migrating an application from unix to linux.
The following output i am getting in unix and linux.

ftp> dir /test/1.c
227 Passive Mode (143,90,129,198,78,223)
150 Opening ASCII mode data connection for directory listing.
-rw-r--r-- 1 529921 100 114 Jul 31 15:14 /test/1.c
226 Transfer complete.

ftp> dir /usr/local/test_amp/test/
227 Entering Passive Mode (127,0,0,1,129,229)
150 Here comes the directory listing.
-rw-r--r-- 1 1003 701 89 Jul 31 06:33
226 Directory send OK.

In UNIX 64 the dir command will give the details along with pathname at end ( BOLD )

But in RHEL 5 i am just getting the file name.

Please update me is thery any way to get the pathname in dir command of FTP in RHEL 5.

Any suggestions are welcome.

Thanks and Regards
Old 07-31-2009, 10:15 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
I don't think there is an easy solution. The output of the ftp commands is determined by the server end, and the commands are quite restricted (with good reason).

You can try the different ftp list commands ('dir', 'ls', and 'nlist'), but they typically just give relative paths.

You could use the 'pwd' command to give the directory path, and then (using code at the client end) concatenate this to each of the files in 'nlist'.

It would be worth doing a 'man' of the particular ftp server software that you are accessing in RHEL, to see if there are any configuration settings that would help at the server end (if it is vsftpd, I can't see any relevant settings).

Even listing the full paths locally requires using the find command (but you don't have remote access to 'find' through ftp), eg
find $PWD/* -maxdepth 0

Last edited by neonsignal; 07-31-2009 at 10:21 PM.
Old 08-03-2009, 02:04 AM   #3
Registered: Feb 2009
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for the reply.
We modified the code. We changed the code to extract the file name and made the changes to sync the business logic unchanged..

The way you suggested is also one of the solution.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 03:57 PM
How to ftp a dir in RH9 v1nc3nt Linux - Newbie 2 05-12-2006 09:35 AM
FTP incoming dir gabsik Linux - Networking 1 04-20-2006 10:44 PM
Cannot list dir via FTP Ephracis Linux - Software 7 12-11-2004 07:24 PM
cant ls,dir with ftp client steve_babbage Linux - Security 1 01-07-2004 04:46 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration