0

How to get count of files from a folder(directory) in u-sql

if the folder has more than one file then process only the latest file else process first file !!

steve
  • 79
  • 8

1 Answers1

0

As I said in comments you can do something like this:

DECLARE EXTERNAL @input string = @"/someFolder/{file}.csv";

@extractedData = EXTRACT file as string,
                         col1 as number,
                         col2 as string
                         FROM @input
                         USING new Extractors.Csv();

So whit this you will extract all files in folder and use it, even if it is one file or multiple. You need to guarantee that the files have same structure or your extractor will throw an error like

"expected 3 columns but got "x" columns...

After that you can work on your files data.

Kiril1512
  • 3,231
  • 3
  • 16
  • 41
  • i want to know the count of files from a directory in u-sql. how can we achieve that in u-sql ? – steve Nov 01 '19 at 11:58