The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SED command is not executing within the shell naushad UNIX for Dummies Questions & Answers 1 03-26-2008 04:35 AM
Remotely executing awk command bishweshwar Shell Programming and Scripting 1 07-14-2007 05:20 PM
Executing a unix command jacob23 UNIX for Dummies Questions & Answers 5 12-20-2006 10:36 PM
executing the su command from a script. shailendrat Shell Programming and Scripting 6 04-11-2005 01:44 AM
Automatically executing a command robbiegregg UNIX for Dummies Questions & Answers 8 04-06-2005 11:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-26-2006
alx alx is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 9
executing dir or ls command via FTP

Hi,

I need to get latest *.txt file from windows server via executing FTP command from Unix box. So I decided to get the list of files first and then get only the latest. When I execute "ls *.txt" command and redirect list of files to a local file, it works fine. As soon as I add parameter "ls -t *.txt" it stops working and doesn't populate local file with list of files on Windows server.
Same happens when I try to execute "dir *.txt" - works fine, as soon as I added "dir /O-d *.txt" - trying to sort files and create list in sorted order it stops working. What am I doing wrong ?
-Thank you.
  #2 (permalink)  
Old 01-26-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
ftpd - the process on the remote box that allows an ftp transfer - does not support
options.

While in ftp try
Code:
help site  or help quote
to see if there are commands you can use. Sometimes you can ftp a script to the remote directory then run it. The script creates a physical file. ftp the file to your side and then read it.

The simplest way is to get all the "*.txt" files, then do a diff on the new ones to see if they are indeed different from the old ones (that are in another directory so they are not overwritten). Samba will remote mount disks on a windows server for you as well.
  #3 (permalink)  
Old 01-26-2006
alx alx is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 9
Thank you so much for such a promt reply - it's very encouraging...
  #4 (permalink)  
Old 01-26-2006
alx alx is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 9
I have also tried to populate list without any option and it gives me this list:
-rwxrwxrwx 1 owner group 9538 Jan 13 16:23 ALX_TEST.txt
-rwxrwxrwx 1 owner group 4 Jan 26 14:19ALX_TEST_LATEST.txt
-rwxrwxrwx 1 owner group 9538 Nov 17 2005 TestACH.txt

Now I can use awk and print commands to get the date and time part...but I don't see any date functions that would allow me to convert string "Jan 13 12:23" into date and be able to compare with date of another file... any thoughts on that ?

-thanks
  #5 (permalink)  
Old 01-26-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Check this thread specifically this post.
  #6 (permalink)  
Old 01-27-2006
alx alx is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 9
Jim,

I have created get_list.bat file ftp'd it over to the remote directory on windows, then issued separate ftp command and tried to run this get_list.bat file. I was getting "invalid command" error message. Have you done execution of a *.bat command on a remote server before ?

thanks
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0