File Stat
Retrieves metadata and statistics for a file or folder in Dropbox.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Client ID - The client identifier returned from the Connect node.
- Dropbox Path - Path to the file or folder to get statistics for (without leading slash).
Output
- Stats - An object containing file or folder statistics with the following properties:
is_dir(boolean): Whether the path is a directoryname(string): Name of the file or foldersize(integer): Size in bytes (0 for folders)mod_time(timestamp): Last modification time
How It Works
The File Stat node retrieves detailed information about a file or folder in Dropbox. When executed, the node:
- Validates the required inputs (Client ID and Dropbox Path)
- Retrieves the access token using the provided Client ID
- Prepends "/" to the path as required by the Dropbox API
- Queries the Dropbox API for file/folder metadata
- Returns a stats object containing the file or folder information
Path Format
- Paths should be provided without a leading slash
- The node automatically adds the leading "/" for Dropbox API compatibility
- Examples:
- Input:
documents/report.pdf→ API uses:/documents/report.pdf - Input:
photos→ API uses:/photos
- Input:
Requirements
- A valid Dropbox connection (using the Connect node)
- The file or folder must exist in Dropbox
- Read permissions for the specified path
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Client ID
- Empty Dropbox Path
- File or folder does not exist
- Insufficient permissions to access the path
- Dropbox API errors
Usage Notes
- The stats object is returned as a JSON object in the message context
- For folders, the size is always 0
- The modification time is in ISO 8601 format
- Use this node to verify file existence before operations
- Useful for conditional logic based on file properties
Stats Object Structure
{
"is_dir": false,
"name": "report.pdf",
"size": 1048576,
"mod_time": "2024-03-15T10:30:00Z"
}
Example 1: Check File Information
Get details about a specific file:
Inputs:
- Client ID: (from Connect node)
- Dropbox Path:
documents/report.pdf
Output (stats):
{
"is_dir": false,
"name": "report.pdf",
"size": 2457600,
"mod_time": "2024-03-15T14:30:00Z"
}
Example 2: Check if Path is a Folder
Determine if a path points to a folder:
Inputs:
- Client ID: (from Connect node)
- Dropbox Path:
projects/website
Output (stats):
{
"is_dir": true,
"name": "website",
"size": 0,
"mod_time": "2024-03-10T09:00:00Z"
}
Usage in flow:
FileStat
↓
If stats.is_dir is true
└─ ListFiles (it's a folder)
Else
└─ DownloadFile (it's a file)
Example 3: Verify File Exists Before Download
Check file existence and size before downloading:
FileStat
↓
If stats exists
├─ Check stats.size
├─ If size < 10MB
│ └─ DownloadFile
└─ Else
└─ Log "File too large"
Example 4: Check File Modification Time
Determine if a file has been modified recently:
FileStat
↓
Get stats.mod_time
↓
If mod_time is within last 24 hours
└─ Process file
Else
└─ Skip file (too old)
Common Use Cases
- Verifying file existence before operations
- Checking file size before downloading
- Determining if a path is a file or folder
- Filtering files by modification time
- Validating file properties before processing
- Implementing conditional logic based on file metadata
- Monitoring file changes over time
- Building file inventory systems
Best Practices
- Use FileStat to verify existence before file operations
- Check
is_dirproperty to handle files and folders differently - Consider file size when planning downloads or processing
- Use modification time for incremental processing
- Implement error handling for non-existent files
- Cache stats results if needed multiple times in a flow
- Combine with ListFiles for comprehensive folder analysis
Working with File Sizes
File sizes are returned in bytes. Convert to human-readable formats:
- Bytes: size (as returned)
- Kilobytes (KB): size / 1024
- Megabytes (MB): size / 1024 / 1024
- Gigabytes (GB): size / 1024 / 1024 / 1024
Example conversion in workflow:
FileStat
↓
Set size_mb = stats.size / 1024 / 1024
↓
Log "File size: {size_mb} MB"
Working with Modification Times
The mod_time field contains a timestamp that can be used for:
- Sorting files by date
- Filtering files modified within a time range
- Implementing incremental backup strategies
- Detecting stale or outdated files
- Audit trail and compliance tracking
Example time comparison:
FileStat
↓
Set file_age = current_time - stats.mod_time
↓
If file_age > 30 days
└─ Archive or delete file
Tips
- Use the
is_dirproperty to avoid attempting file operations on folders - Check file size before downloading to prevent memory issues
- Combine FileStat with conditional nodes for smart workflows
- Use Continue On Error to handle missing files gracefully
- Access stats properties using dot notation:
stats.name,stats.size, etc. - Store stats in variables for reuse throughout the workflow
Error Recovery
If FileStat fails:
- File not found: The path doesn't exist or is incorrect
- Permission denied: Insufficient access rights
- Invalid path: Check path format and special characters
- API errors: Verify connection and token validity
Pattern: Conditional Download Based on Size
Download files only if they're under a size limit:
FileStat
↓
If stats.is_dir is false AND stats.size < 5000000 (5MB)
└─ DownloadFile
Else if stats.is_dir is true
└─ Log "Cannot download folder"
Else
└─ Log "File too large to download"
Pattern: Check Before Delete
Verify file exists and get info before deletion:
FileStat
↓
Log "Deleting: {stats.name}, Size: {stats.size} bytes"
↓
DeleteFile
Pattern: Smart Backup
Only backup files modified since last backup:
Get last_backup_time
↓
FileStat
↓
If stats.mod_time > last_backup_time
├─ CopyFile (create backup)
└─ Update last_backup_time
Else
└─ Log "File unchanged, skipping backup"
Accessing Stats Properties
In your workflow, access individual properties:
stats.is_dir- Boolean indicating if it's a directorystats.name- String containing the file/folder namestats.size- Integer file size in bytesstats.mod_time- Timestamp of last modification
Integration with Other Nodes
FileStat works well with:
- DownloadFile: Check size before downloading
- DeleteFile: Verify existence before deletion
- CopyFile/MoveFile: Validate source file exists
- ListFiles: Compare individual file stats
- Conditional nodes: Implement logic based on file properties