Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    south london
    Posts
    1

    Unanswered: 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

  2. #2
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •