I'm a newbie. I have a question:
The following script is supposed to list the first(oldest) 40 archived directories and remove them one by one, but I do not think it's correct. Seems that it will remove all the directories, not just the 40 mentioned. Please advise.
setenv archiveDir <someArchivePath>
foreach x (`ls -t ${archiveDir}/ | awk 'BEGIN {k=40} {k--; if(k<0) {print $0}}'`)
rm -rf ${archiveDir}/${x}
echo ${archiveDir}/${x}
end
The following script is supposed to list the first(oldest) 40 archived directories and remove them one by one, but I do not think it's correct. Seems that it will remove all the directories, not just the 40 mentioned. Please advise.
setenv archiveDir <someArchivePath>
foreach x (`ls -t ${archiveDir}/ | awk 'BEGIN {k=40} {k--; if(k<0) {print $0}}'`)
rm -rf ${archiveDir}/${x}
echo ${archiveDir}/${x}
end