delete old files from windows thru unix script - TechRepublic
General discussion
February 8, 2010 at 10:50 AM
suja.nair

delete old files from windows thru unix script

by suja.nair . Updated 16 years, 4 months ago

I have to delete files older than 60 days from a windows directory. So I tried to include this script

FTP_LOG=${DATA_TOP}/data_tmp/logfile
FTP_CMDS=${DATA_TOP}/data_tmp/cmdfile
echo “open ftp1” > ${FTP_CMDS}
echo “user anonymous local” >> ${FTP_CMDS}
echo “cd ${SRC_DIR}” >> ${FTP_CMDS}
echo “find . -mtime +56 -exec rm -f {} \;” >> ${FTP_CMDS}
echo “bye” >> ${FTP_CMDS}
ftp -iv ${SERVER_NAME} < ${FTP_CMDS} > ${FTP_LOG}

But it is not recognizing the find command. I am getting “?Invalid command” error. I think I have to use windows ftp command to delete files. what command can I use to delete files older than 60 days?

This discussion is locked

All Comments