Val Krem
2016-12-10 19:52:22 UTC
Hi all,
In one folder a I have several files( >200). These files do have the same columns(variables). The file names do have two patterns and want concatenate these files into two groups based on their file name pattern.
The file names look like as follow.
Region-19940726.csv
Region-19940816.csv
Region-19940920.csv
Region-19941018.csv
Region-19941122.csv
Region.csv
RegionAB-19940726.csv
RegionAB-19940816.csv
RegionAB-19940920.csv
RegionAB-19941018.csv
RegionAB-19941122.csv
RegionAB.csv
The first file (file1) should include all files that starts with 'RegionAB' and inlcude the following files
RegionAB-19940726.csv
RegionAB-19940816.csv
RegionAB-19940920.csv
RegionAB-19941018.csv
RegionAB-19941122.csv
RegionAB.csv
The second output file (file2) should include all files that start with 'Region'
Region-19940726.csv
Region-19940816.csv
Region-19940920.csv
Region-19941018.csv
Region-19941122.csv
Region.csv
Is there an efficient way of doing this?
thank you in advance
In one folder a I have several files( >200). These files do have the same columns(variables). The file names do have two patterns and want concatenate these files into two groups based on their file name pattern.
The file names look like as follow.
Region-19940726.csv
Region-19940816.csv
Region-19940920.csv
Region-19941018.csv
Region-19941122.csv
Region.csv
RegionAB-19940726.csv
RegionAB-19940816.csv
RegionAB-19940920.csv
RegionAB-19941018.csv
RegionAB-19941122.csv
RegionAB.csv
The first file (file1) should include all files that starts with 'RegionAB' and inlcude the following files
RegionAB-19940726.csv
RegionAB-19940816.csv
RegionAB-19940920.csv
RegionAB-19941018.csv
RegionAB-19941122.csv
RegionAB.csv
The second output file (file2) should include all files that start with 'Region'
Region-19940726.csv
Region-19940816.csv
Region-19940920.csv
Region-19941018.csv
Region-19941122.csv
Region.csv
Is there an efficient way of doing this?
thank you in advance