title: Spring batch - get information about files in a directory
body: <p>So I'm toying around with Spring Batch for the first time and trying to understand how to do things other than process a CSV file. </p>
  
  <p>Attempting to read every music file in a directory for example, I have the following code but I'm not sure how to handle the <code>Delegate</code> part. </p>
  
  <pre><code>@Configuration
  @EnableBatchProcessing
  public class BatchConfiguration {
  
      @Autowired
      public JobBuilderFactory jobBuilderFactory;
  
      @Autowired
      public StepBuilderFactory stepBuilderFactory;
  
      @Bean
      public MusicItemProcessor processor() {
          return new MusicItemProcessor();
      }
  
      @Bean
      public Job readFiles() {
          return jobBuilderFactory.get("readFiles").incrementer(new RunIdIncrementer()).
                  flow(step1()).end().build();
      }
  
      @Bean
      public Step step1() {
          return stepBuilderFactory.get("step1").&lt;String, String&gt;chunk(10)
                  .reader(reader())
                  .processor(processor()).build();
      }
  
      @Bean
      public ItemReader&lt;String&gt; reader() {
          Resource[] resources = null;
          ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
          try {
              resources = patternResolver.getResources("file:/music/*.flac");
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          MultiResourceItemReader&lt;String&gt; reader = new MultiResourceItemReader&lt;&gt;();
          reader.setResources(resources);
          reader.setDelegate(new FlatFileItemReader&lt;&gt;()); // ??
  
          return reader;
      }
  
  }
  </code></pre>
  
  <p>At the moment I can see that resources has a list of music files, but looking at the stacktrace I get back, it looks to me like <code>new FlatFileItemReader&lt;&gt;()</code> is trying to read the actual content of the files (I'll want to do that at some point, just not right now). </p>
  
  <p>At the moment I just want the information about the file (absolute path, size, filename etc), not what's inside. </p>
  
  <p>Have I gone completely wrong with this? Or do I just need to configure something a little different? </p>
  
  <p>Any examples of code that does more than process CSV lines would also be awesome</p>