hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
705 stars 179 forks source link

Filter multiple types of files #793

Open desolate-planet opened 12 months ago

desolate-planet commented 12 months ago

Hello,

I'm started to use this API to clear some SMB shares and I've tried the following API call:

for (FileIdBothDirectoryInformation f : share.list(targetFolder, "*.pdf"))

This works fine, but if I do the following: for (FileIdBothDirectoryInformation f : share.list(targetFolder, ".pdf, .xml")) , it doesn't work. I can't find any documentation on valid search patterns of even any examples. Can someone confirm what the correct pattern should be.

Also, is this the correct API call for files only, as I simply want to grab file details from a directory, check the age date and if the date has exceeded, I want to delete it. This API call is also providing directory info in it's results when it's purely files I'm after.

Thanks

hierynomus commented 11 months ago

Hi!

This is where you can find the reference to how this is implemented: MS-SMB2 2.2.33

  1. As you can see, all possible FileInformationClass options, talk about files and directories in a directory, so indeed, you will always get both
  2. The specifics for the wildcard are actually specified in MS-FSCC 2.2.1.1.3
hierynomus commented 11 months ago

Did this answer your question?