- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Urgent- Problem in FTP
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2008 07:43 PM
тАО08-26-2008 07:43 PM
Urgent- Problem in FTP
I need some help urgently , i written script (HP-UX) for ftp files from remote machine,its working fine, but requirement is i have to ftp files from remote machine only of yesterday,filename do not have any string of date , so timestamp is only criteria ,please advice how to ftp files of yesterday
Thanks & Regards
- Tags:
- ftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-2008 10:25 PM
тАО08-26-2008 10:25 PM
Re: Urgent- Problem in FTP
ftp -in myhost << EOF
user username password
get /tmp/bla
get /tmp/foo
EOF
That's how to do it.
That being said, this is very insecure, with the password in the script and being transmitted in clear text along with the data without any encryption.
If you use openssh scp function with password free access, the whole thing can be secure and a less complex script.
Here is how.
http://www.hpux.ws/?p=10
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 12:05 AM
тАО08-27-2008 12:05 AM
Re: Urgent- Problem in FTP
This means you will need to first use the "ls" command. Then parse the output, then redo the ftp to copy selected files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 12:12 AM
тАО08-27-2008 12:12 AM
Re: Urgent- Problem in FTP
But can you eloborate how i do
Do You mean first i ftp all files(are in large number) to local machine,then i use
ls command to filter the files and delete unwanted from local directory
Or you mean some other solution
Is there any way to pass information to ftp session to ftp only files of yesterday timestamp
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 12:41 AM
тАО08-27-2008 12:41 AM
Re: Urgent- Problem in FTP
find / -name "filename*.txt" -mtime 0
shows yesterdays file
using ls -l | awk '{ if ($6 == "Aug" && $7 == "14") ptint $NF,$6,$7 }' > /tmp/filelist.out
Then you can use this file to ftp files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 01:26 AM
тАО08-27-2008 01:26 AM
Re: Urgent- Problem in FTP
But i need to automate this process,
I mean shell script will run daily as scheduled, ftp files and futher program process this files,so first part is to ftp yesterday files daily from remote machine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 05:24 AM
тАО08-27-2008 05:24 AM
Re: Urgent- Problem in FTP
> But i need to automate this process,
I mean shell script will run daily as scheduled, ftp files and futher program process this files,so first part is to ftp yesterday files daily from remote machine
As Dennis said, you need to connect to your remote server in an FTP session and issue the 'dir' command within FTP. You collect this information in a file in your script.
When this FTP connection is complete, you parse what you need from the file; build any variables necessary; start another FTP session and put or get files as desired.
All of this can be built into one script.
To collect a remote server's file information you do something like:
{ echo "open somehostname
user someuser thepassword
cd remotedir
lcd tempdir
dir remotedir localfile
quit"
} | ftp -i -n -v
...the contents of the "remotedir" on "somehostname" will be written with timestamp information into your "localfile". Parse that and continue processing.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2008 08:03 PM
тАО08-27-2008 08:03 PM
Re: Urgent- Problem in FTP
I was trying to get if any way to pass information to ftp about date of file
But if that is not possible i think this alternative solution to dir all files from remote machine and parse list locally then ftp again is ok,but when i dir all files of remote machine to file of local machine then in that list file name and date appears on seperate lines, so its difficult to grep etc
example filename1 01-01-2007
filename 2
09-01-2007
pl suggest how to parse this info
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 12:41 AM
тАО08-28-2008 12:41 AM
Re: Urgent- Problem in FTP
example filename1 01-01-2007
filename2
09-01-2007
What type of machine is the remote one?
If HP-UX, both ls and dir produce the standard ll(1) output.
To merge the two lines you can use sed:
sed -e 'N; s/\n/ /' file
>JRF: dir remotedir localfile
When I did this interactively, I had to use "prompt" to turn off this question:
output to local-file: localfile? y
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 10:13 AM
тАО08-28-2008 10:13 AM
Re: Urgent- Problem in FTP
> Dennis: When I did this [dir remotedir localfile] interactively, I had to use "prompt" to turn off this question:
output to local-file: localfile? y
Yes, that appears to be the interactive behavior. If you use the shell snippet I posted, there is no prompt, though.
As for the OP's response that the names and date information (sometimes?) appear on separate lines:
filename1 01-01-2007
filename 2
09-01-2007
...This looks like a Window's listing. Are there evil spaces in filenames? [the dumbest thing Windows ever allowed!!!]
Are the filenames simply long names that wrap around a terminal's display?
It would be helpful if in addition to answering the above, you *posted* (as an *attachement*) the actual directory listing returned by the FTP snippet I suggested. I wonder if there are whitespace and/or other non-printing characters in some of you filenames.
Regards!
...JRF...