0

I use SAS Grid and I'm trying to set up a process which looks for files older than 180 days. I need to locate both .sas7bdat and .sas7bndx files. The results are output to a .txt file for manipulation in SASDI

I have been able to locate each file type separately but when I try for multiple extensions I get the error;4

find: paths must precede expression: (-iname

The code I am using is;

$find /opt/SAS/SASdata/DOM/Prod/5_userdata/  -type f \(-iname "*.sas7bdat" -o -iname "*.sas7bndx" \) -mtime +180 -ls >mofindx.txt 

I have tried a few variations of the above like removing the \, or ( or changing the position of the query and get variations on the error.

Digvijay S
  • 2,665
  • 1
  • 9
  • 21
  • https://unix.stackexchange.com/questions/15308/how-to-use-find-command-to-search-for-multiple-extensions – Digvijay S Apr 24 '20 at 09:58
  • Try `find /opt/SAS/SASdata/DOM/Prod/5_userdata/ -type f \(-iname "*.sas7bdat" -o "*.sas7bndx" \) -mtime +180 -ls >mofindx.txt ` – Digvijay S Apr 24 '20 at 09:59
  • Note: Don't use `-iname`, use regular `-name`. SAS will only recognize datasets where the physical filename is in lowercase on Unix systems. – Tom Apr 24 '20 at 13:50
  • following the link from Digvijay i found find ./ -type f \( -iname \*.sas7bdat -o -iname \*.sas7bndx \) -mtime +180 -ls >mofindx.txt which works in shell but will not pass from DIS - i need to get it to do this for automation – Jordan Wood Apr 24 '20 at 14:11

0 Answers0