If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > how to remove files older than xx via ftp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-04, 09:41
stewartski stewartski is offline
Registered User
 
Join Date: Jan 2004
Location: south london
Posts: 1
how to remove files older than xx via ftp

Hi
I'm familiar with *find /xxxx -type f -atime +14 -exec rm -f {} \;*

however I'm trying to get it to work in an ftp session as follows:

#!/bin/sh
HOST='xxx'
USER='yyy'
PASSWD='zzz'

ftp -i -n -v $HOST <<END_SCRIPT
!find /xxxx -type f -atime +14 "-exec rm -f {}" ;
quit
END_SCRIPT
exit 0

The ftp session stuff works fine, I've used it lots of times - the *find* part doesn't. Currently I get this: *invalid predicate '-exec rm -f {}'*

Can anyone tell if this is even possible? I've searched high and lo, tried a million variations, with no luck.

Any help gratefully rxed.

thanks
Reply With Quote
  #2 (permalink)  
Old 01-21-04, 13:26
chillies chillies is offline
Registered User
 
Join Date: Jul 2003
Location: Edinburgh
Posts: 35
Re: how to remove files older than xx via ftp

The exclamation mark tells the ftp client to interpret the remainder of the line as a command for the local machine, not the remote one. Luckily, your command has a syntax error or you could have trashed your machine.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On