This should be simple but I could not get it working. I would like to list the files in a directory by excluding files containing a certain pattern using glob.glob in python.
The files in my directory are:
lh.Hip.nii, lh.IPL.nii, lh.LTC.nii, rh.Hip.nii, rh.IPL.nii, rh.LTC.nii
and I would like to list the files by excluding the ones containing "Hip" in the file name:
lh.IPL.nii, lh.LTC.nii, rh.IPL.nii, rh.LTC.nii
There is a similar question glob exclude pattern and the solution only works if I want to exclude files starting with a certain pattern but it does not work in my case.
Any ideas?