Need a shell script to filter out directories
August 10, 2011 7:52 AM Subscribe
Shell gurus needed! I need a line/script that will create a list of all sub-folders within a folder that do not contain files with a certain filename pattern. There is an additional requirement...(more inside)
posted by dukes909 to Computers & Internet (12 answers total) 1 user marked this as a favorite
Given a folder /somefolder , I need to be able to create a list of all subfolders within /somefolder that:
1) have files of the pattern *.tif
2) do not have files of the pattern *_Aug11.pdf
In other words a folder containing 8107.tif AND 8107_Aug11.pdf would not match the search expression.
However, a folder containing 8107.tif AND 8107.pdf would match, as would a folder containing just 8107.tif alone, or 8107.tif, 8108.tif, etc. provided there are NO associated _Aug11.pdf for each of those.
The script can be a Windows powershell or unix shell script...