Sponsored Content
Top Forums Shell Programming and Scripting Picking up last two specific files, for transfer Post 303019269 by fretagi on Tuesday 26th of June 2018 06:31:39 AM
Old 06-26-2018
Picking up last two specific files, for transfer

Hi

I need to transfer files with csv extension from one server to another (all running solaris).
But the files to be picked are in a directory that also has:

Code:
/directory
deposit_698.csv
deposit_698.checksum
deposit_699.csv
deposit_699.checksum
deposit_700.csv
deposit_700.checksum
Withdrawal_697.csv
Withdrawal_697.checksum
Withdrawal_698.csv
Withdrawal_698.checksum
Withdrawal_699.csv
Withdrawal_699.checksum
Withdrawal_700.csv
Withdrawal_700.checksum

In this case I need to transfer the deposit_700.csv and the Withdrawal_700.csv to a deposits folder on another server and withdrawls folder.

My script is as follows:

Code:
#!/bin/sh
HOST=192.168.6.25
USER=rico
PASSWD=123xyz
/usr/bin/ftp -inv <<EOF
open $HOST
user $USER $PASSWD
binary
cd /home/scripts/Live deposits/input
mput *Deposit_* | head -n 1*
cd /home/script/Live withdrawal/input
mput *Withdrawal_* | head -n 1*
bye
EOF

My first problem is that one of the directory name in the destination server has a space on the directory name Live deposits and live withdrawals.
the second problem is that I am not able to transfer the last Deposit_700.csv and Withdrawal_700.csv.

my files are going to one folder before the folder with space on its name

---------- Post updated at 12:31 PM ---------- Previous update was at 12:04 PM ----------

Hi

I solve my first problem by using:

cd /home/scripts/Live\ deposits/input
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How do i transfer files

Im trying to transfers a file from one unix server to another , make some changes and then send it back to the original server. All this using modems. I've been using "cu" and i can "get" the file but i can't "put" it. Besides I need to do this using a shell script. I can write a script to get... (4 Replies)
Discussion started by: phsoft
4 Replies

2. Shell Programming and Scripting

transfer of specific file content to another file

What commands do you need to transfer a specfic portion of a file content to another file? eg file_one has 00012 10012 00013 10013 00014 10014 So I just want to transfer all the values of the second column ie 10012, 10013, 10014 to be transferred to file_two? Thanks in advance.... (1 Reply)
Discussion started by: mem101
1 Replies

3. UNIX for Dummies Questions & Answers

How to transfer files

(0 Replies)
Discussion started by: spoonman
0 Replies

4. UNIX for Dummies Questions & Answers

How to transfer files

please help me to transfer files from one server to another one i am having problem in it thanks (1 Reply)
Discussion started by: pankaj001np
1 Replies

5. Shell Programming and Scripting

Copying specific files from remote m/c to specific folders

Hi All, I am trying to rsync some of the latest files from remote m/c to my local linux box. Folder structure in my remote m/c looks like this /pub/Nightly/Package/ROLL/WIN /pub/Nightly/Package/SOLL/sol /pub/Nightly/Package/SOLL/linux Each of the folder contains gzip files which on daily... (0 Replies)
Discussion started by: jhoomsharabi
0 Replies

6. Shell Programming and Scripting

Transfer Of Files

How to transfer the files in windows server to the unix server by using the unix or ftp commands? (1 Reply)
Discussion started by: vinay123
1 Replies

7. Shell Programming and Scripting

Urgent ...pls Sorting files based on timestamp and picking the latest file

Hi Friends, Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp $ printf '%s\n' *.dat* | sort -t. -k3,4 filename_1.dat.20120430.Z filename_2.dat.20120430.Z filename_3.dat.20120430.Z filename_1.dat.20120501.Z filename_2.dat.20120501.Z... (1 Reply)
Discussion started by: robertbrown624
1 Replies

8. UNIX for Dummies Questions & Answers

Sorting files based on timestamp and picking the latest file

Hi Friends, Newbie to shell scripting Currently i have used the below to sort data based on filenames and datestamp $ printf '%s\n' *.dat* | sort -t. -k3,4 filename_1.dat.20120430.Z filename_2.dat.20120430.Z filename_3.dat.20120430.Z filename_1.dat.20120501.Z filename_2.dat.20120501.Z... (12 Replies)
Discussion started by: robertbrown624
12 Replies

9. Linux

How to transfer files...

Hi guys, ok so, how do you go about networking between Windows and Linux so that I can transfer files between each other? (5 Replies)
Discussion started by: billcrosby
5 Replies

10. Shell Programming and Scripting

Picking up files conditionally

Hi I have a scenario: I have a directory say DIR1 (no sub directories) and have few files in that directory as given below: app-cnd-imp-20150820.txt app-cxyzm-imp-20150820.txt app-petco-imp-20150820.txt app-mobility-imp-20150820.txt app-mobility-imp-20150821.txt... (7 Replies)
Discussion started by: Saanvi1
7 Replies
tftp(1) 							   User Commands							   tftp(1)

NAME
tftp - trivial file transfer program SYNOPSIS
tftp [ host [port]] DESCRIPTION
tftp is the user interface to the Internet TFTP (Trivial File Transfer Protocol), which allows users to transfer files to and from a remote machine. The remote host and optional port may be specified on the command line, in which case tftp uses host as the default host, and if specified, port as the default port, for future transfers. See the connect command below. USAGE
Once tftp is running, it issues the prompt tftp> and recognizes the following commands: Commands connect host-name [ port ] Set the host, and optionally port, for transfers. The TFTP protocol, unlike the FTP protocol, does not maintain connections between transfers; thus, the connect command does not actually create a connection, but merely remembers what host is to be used for transfers. You do not have to use the connect command; the remote host can be specified as part of the get or put commands. mode transfer-mode Set the mode for transfers; transfer-mode may be one of ascii or binary. The default is ascii. put filename put localfile remotefile put filename1 filename2 ... filenameN remote-directory Transfer a file, or a set of files, to the specified remote file or directory. The destination can be in one of two forms: a filename on the remote host if the host has already been specified, or a string of the form: host:filename to specify both a host and filename at the same time. If the latter form is used, the specified host becomes the default for future transfers. If the remote-directory form is used, the remote host is assumed to be running the UNIX system. The host can be a host name (see hosts(4) or ipnodes(4)) or an IPv4 or IPv6 address string (see inet(7P) or inet6(7P)). Since IPv6 addresses already contain ":"s, the host should be enclosed in square brackets when an IPv6 address is used. Otherwise, the first occurrence of a colon will be interpreted as the separator between the host and the filename. For example, [1080::8:800:200c:417A]:myfile Files may be written only if they already exist and are publicly writable. See in.tftpd(1M). get filename get remotename localname get filename1 filename2 filename3 ... filenameN Get a file or set of files (three or more) from the specified remote sources. source can be in one of two forms: a filename on the remote host if the host has already been specified, or a string of the form: host:filename to specify both a host and filename at the same time. If the latter form is used, the last host specified becomes the default for future transfers. See the put command regarding specifying a host. quit Exit tftp. An EOF also exits. verbose Toggle verbose mode. trace Toggle packet tracing. status Show current status. rexmt retransmission-timeout Set the per-packet retransmission timeout, in seconds. timeout total-transmission-timeout Set the total transmission timeout, in seconds. ascii Shorthand for mode ascii. binary Shorthand for mode binary. blksize transfer-blocksize The value of the transfer blocksize option to negotiate with the server. A value of 0 disables the negotiation of this option. srexmt server-retransmission-timeout The value of the retransmission timeout option to request that the server uses. A value of 0 disables the negotiation of this option. tsize A toggle that sends the transfer size option to the server. By default, the option is not sent. The transfer size option is not sent with a write request when the transfer-mode is ascii. ? [ command-name ... ] Print help information. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWtftp | +-----------------------------+-----------------------------+ SEE ALSO
in.tftpd(1M), hosts(4), ipnodes(4),attributes(5),inet(7P), inet6(7P) Malkin, G. and Harkin, A. RFC 2347, TFTP Option Extension. The Internet Society. May 1998 Malkin, G. and Harkin, A. RFC 2348, TFTP Blocksize Option. The Internet Society. May 1998 Malkin, G. and Harkin, A. RFC 2349, TFTP Timeout Interval and Transfer Size Options. The Internet Society. May 1998 Sollins, K.R. RFC 1350, The TFTP Protocol (Revision 2). Network Working Group. July 1992. NOTES
The default transfer-mode is ascii. This differs from pre-SunOS 4.0 and pre-4.3BSD systems, so explicit action must be taken when transfer- ring non-ASCII binary files such as executable commands. Because there is no user-login or validation within the TFTP protocol, many remote sites restrict file access in various ways. Approved methods for file access are specific to each site, and therefore cannot be documented here. When using the get command to transfer multiple files from a remote host, three or more files must be specified. If two files are speci- fied, the second file is used as a local file. SunOS 5.10 2 Jan 2002 tftp(1)
All times are GMT -4. The time now is 12:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy