func (d *Deleter) Files(paths []string) error {
	for _, p := range paths {
		// fail silently if the file does not exist
		if _, err := d.RenamerRemover.Stat(p); err != nil {
			if errors.Is(err, fs.ErrNotExist) {
				logger.Warnf("File %q does not exist and therefore cannot be deleted. Ignoring.", p)
				continue
			}

			return fmt.Errorf("check file %q exists: %w", p, err)
		}

		if err := d.renameForDelete(p); err != nil {
			return fmt.Errorf("marking file %q for deletion: %w", p, err)
		}
		d.files = append(d.files, p)
	}

	return nil
}
// Files designates files to be deleted. Each file marked will be renamed to add
// a `.delete` suffix. An error is returned if a file could not be renamed.
// Note that if an error is returned, then some files may be left renamed.
// Abort should be called to restore marked files if this function returns an
// error.
Files designates files to be deleted. Each file marked will be renamed to add
a `.delete` suffix. An error is returned if a file could not be renamed.
Note that if an error is returned, then some files may be left renamed.
Abort should be called to restore marked files if this function returns an
error.
// Files designates files to be deleted . Each file marked will be renamed to add // a ` . delete ` suffix . An error is returned if a file could not be renamed . // Note that if an error is returned then some files may be left renamed . // Abort should be called to restore marked files if this function returns an // error .
func (d *Deleter) Files(paths []string) error {
	for _, p := range paths {
		if _, err := d.RenamerRemover.Stat(p); err != nil {
			if errors.Is(err, fs.ErrNotExist) {
				logger.Warnf("File %q does not exist and therefore cannot be deleted. Ignoring.", p)
				continue
			}
			return fmt.Errorf("check file %q exists: %w", p, err)
		}
		if err := d.renameForDelete(p); err != nil {
			return fmt.Errorf("marking file %q for deletion: %w", p, err)
		}
		d.files = append(d.files, p)
	}
	return nil
}
func ( d * Deleter ) Files ( paths [ ] string ) error { for _ , p := range paths { if _ , err := d . RenamerRemover . Stat ( p ) ; err != nil { if errors . Is ( err , fs . ErrNotExist ) { logger . Warnf ( " " , p ) continue } return fmt . Errorf ( " " , p , err ) } if err := d . renameForDelete ( p ) ; err != nil { return fmt . Errorf ( " " , p , err ) } d . files = append ( d . files , p ) } return nil }
Files designates files to be deleted.
Files designates files to be deleted .
// fail silently if the file does not exist