-const incompleteFileSuffix = ".incomplete"
-
-// effectiveFile wraps os.Open to check for the presence of a partial file transfer as a fallback
-func effectiveFile(filePath string) (*os.File, error) {
- file, err := os.Open(filePath)
- if err != nil && !errors.Is(err, fs.ErrNotExist) {
- return nil, err
- }
-
- if errors.Is(err, fs.ErrNotExist) {
- file, err = os.OpenFile(filePath+incompleteFileSuffix, os.O_APPEND|os.O_WRONLY, 0644)
- if err != nil {
- return nil, err
+func ignoreFile(fileName string, ignoreList []string) bool {
+ // skip files that match any regular expression present in the IgnoreFiles list
+ matchIgnoreFilter := 0
+ for _, pattern := range ignoreList {
+ if match, _ := regexp.MatchString(pattern, fileName); match {
+ matchIgnoreFilter += 1