- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: FTP Script
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
Forums
Discussions
Discussions
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
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
11-29-2005 02:02 AM
11-29-2005 02:02 AM
Problem: I try do write a script which should copy all files from a directory where the date is bigger than a other date.
eg.
i go a variable
echo $lastdate
Nov 29 15:19
i need something like:
get * where date >= $lastdate
i hope its possible
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2005 02:11 AM
11-29-2005 02:11 AM
Re: FTP Script
Have a look at the man pages for 'ftp(1)'. You will find a variation of 'get' called 'newer':
newer filename
...will get the file only if the modification time of the remote file is more recent that the file on the current system. If the file does not exist on the current system, the remote file is considered newer.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2005 02:50 AM
11-29-2005 02:50 AM
Re: FTP Script
but i will get more than one file. can I create a loop or something like that?
it isn't possible to write 'newer *' and i don't know the name of each file. in addition i haven't any files on the local machine
ty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2005 02:54 AM
11-29-2005 02:54 AM
Re: FTP Script
Try something like
find / -newer
this will find all files which are newer than the timestamp of
Regards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2005 06:17 PM
12-01-2005 06:17 PM
Solutionwe are talking about ftp!
Baumann,
you can read the directory with
dir into a local file and then extract the names and build a list of ftp commands. You could then create a file with the specific date/time for each file found on the remote site. With the newer command you will get only those newer than the local side. I hope the remote site is in the same time zone as yours.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2005 07:03 PM
12-01-2005 07:03 PM
Re: FTP Script
thx, that's a good idea, i will try to do it. first i thought it's easier to realize it.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2005 10:43 PM
12-01-2005 10:43 PM
Re: FTP Script
I face this problem too. I have to get an unknown number of files and delete them after that on the remote side.
mget *
mdelete *
carries the risk of deleting more files that you transferred if in the mean time new files arrive. I am using an awk script to build an ftp script.
greetings,
Michael
BEGIN {print "cd $data3.tshps1";print "type image";}
/^X/ {print "get " tolower($1);print "delete " tolower($1)}
end
gets all files starting with X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2005 09:56 PM
12-04-2005 09:56 PM
Re: FTP Script
dir . filelist
that works, but in a script it doesn't
ftp -n << END_FTP
open $dbserver
user $username $password
cd $archpath
dir . file_list
bye
END_FTP
Here I must confirm with (y) the dir command. how can i disable the whole prompt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2005 10:04 PM
12-04-2005 10:04 PM
Re: FTP Script
ftp -i -n $dbserver<<-FTP
user $username $password
cd $archpath
dir . file_list
bye
FTP
And,
dir . file_list will give present directory and file_list information rgt? why you can use as,
dir . itself?
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2005 10:14 PM
12-04-2005 10:14 PM
Re: FTP Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2005 10:24 PM
12-04-2005 10:24 PM
Re: FTP Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2005 12:51 AM
12-05-2005 12:51 AM
Re: FTP Script
dir . file_list
is not the same as dir . and dir file_list
The above command records the information in a textfile with the name file_list. Baumann will need it to extract the names of the files to get.
The . does not work always. The remote file system must support that.
Baumann, how far are you?
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2005 02:41 AM
12-05-2005 02:41 AM
Re: FTP Script
now i have all the filenames i need in a textfile.
#textfile
get file1
get file2
.....
how can i generate a ksh-script, that gets every file with ftp? we could open a connection for every file but i think it goes easier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2005 03:06 AM
12-05-2005 03:06 AM
Re: FTP Script
Adjust it to your environment, save it and do
awk -f awkfile file_list
You will get a list of ftp commands which you can use as input for ftp.
I use .netrc for automatic login and then
ftp -i remote < createdftpfile
In my case the filename is in position 1 and start with X.
You will have to find a filter to get the filenames. Choose the transfer method and if you want to rename or delete the file on the remote host.
Michael
BEGIN {print "cd source";print "type image";}
/^X/ {print "get " tolower{$1);print "delete " tolower($1)}
END