关于使用Flowgear资源访问文件元数据的可行性及获取文件最后修改时间的技术咨询
Great question! I’ve worked with similar Flowgear scenarios involving SMB file filtering, so let’s walk through the solutions that will get you what you need:
1. Use a PowerShell Node to Fetch Last Modified Times (Most Reliable Method)
The built-in Flowgear file nodes like File Enumerator don’t expose the Last Modified metadata directly, but you can easily work around this with a PowerShell node executed via your Droppoint. This lets you query SMB file metadata natively and filter for files modified after your target time.
Here’s a sample script you can drop into the PowerShell node:
# Define your SMB share path and cutoff time (adjust these to your needs) $smbPath = "\\your-server\your-share\target-folder" $todayCutoff = Get-Date -Hour 16 -Minute 30 -Second 0 # e.g., 4:30 PM today # Enumerate files, filter by modified time, and return key details Get-ChildItem -Path $smbPath -Recurse -File | Where-Object { $_.LastWriteTime -ge $todayCutoff } | Select-Object FullName, LastWriteTime, Name
- Make sure your Droppoint has read permissions to the SMB share (the Windows user running the Droppoint service needs access).
- The output of this node will be an array of objects with
FullName(full SMB path),LastWriteTime, andName—you can pass this to subsequent nodes (like Loop + File Manage) to process only the filtered files.
2. Alternative: Use a C# Script Node
If you prefer C# over PowerShell, you can achieve the same result with a C# Script node:
using System.IO; using System.Collections.Generic; var smbPath = @"\\your-server\your-share\target-folder"; var cutoffTime = DateTime.Today.AddHours(16).AddMinutes(30); // 4:30 PM today var matchingFiles = new List<object>(); foreach (var file in Directory.GetFiles(smbPath, "*", SearchOption.AllDirectories)) { var lastModified = File.GetLastWriteTime(file); if (lastModified >= cutoffTime) { matchingFiles.Add(new { FullPath = file, LastModified = lastModified, FileName = Path.GetFileName(file) }); } } return matchingFiles;
3. Flowgear Resource Access for Metadata?
Unfortunately, Flowgear’s built-in SMB resource connections are primarily designed for basic file operations (read/write/move) and don’t expose file metadata directly. You’ll still need to use the script-based methods above to fetch Last Modified times, even when using a Flowgear resource—just reference the resource’s path in your script instead of hardcoding it if you want to reuse the connection.
Workflow Example Flow
- Add a PowerShell/C# Script node to enumerate and filter files by Last Modified time.
- Connect the script node’s output to a Loop node to iterate over each matching file.
- Inside the Loop, use File Manage/File Read nodes to process each file as needed.
内容的提问来源于stack exchange,提问作者R.D. Alkire

