|
automated ftp.
Hi
I am trying to delete some specific files ( files other than created today) from the server on a cron basis. I wrote a small script, but I am stuck up in how to delete only specific files.
#!/usr/bin/expect -f
set IP [lindex $argv 0]
set timeout -1
spawn ftp $IP
expect ):
send "username\n"
expect word:
send "password\n"
expect ftp>
send "prompt\n"
expect ftp>
send "passive\n"
expect ftp>
send "cd logs/\n"
expect ftp>
After this I am stuck up. It is because I want to delete files with old dates ie, I don't want to delete the file dated today.
The files are like logfile-070501,logfile-070502 and so on..
I cannot run the command "rm logfile-0705*" ( as it will delete today's file too)
By the way, I have the list of files to be deleted in a separate file. I am wondering if by running any other additional script, we can delete selected files from the remote server .
I tried with ! command of ftp, but it runs the commands on local machine.
Your help will be highly appreciated.Thanks
|