This macOS SwiftUI application retrieves the structure of a directory, including files and subfolders recursively, outputting the result in XML format.
- Directory Selection: Browse and select any folder on your Mac
- XML Generation: Creates a structured XML representation of the selected directory
- Progress Indicator: Shows real-time progress when processing large directories with a progress bar and item counter
- Recursive Traversal: Includes all subdirectories and their files
- File Metadata: Includes file size (in bytes, formatted with dot separators) and modification date for each file
- Syntax Highlighting: XML output is displayed with color-coded syntax highlighting for better readability
- Proper Indentation: XML output is properly indented for easy reading
- Export to File: Save the generated XML to a file with a user-chosen name and location
- Copy to Clipboard: Copy the XML output directly to your clipboard for easy pasting
- Error Handling: Displays user-friendly error messages for any issues
- Localization support: Supports localization system with a language selector view and 5 languages (German, English, French, Italian and Spanish)
XML syntax highlighting feature uses regex operations that can become extremely slow with large XML outputs. This can cause the app to freeze or become unresponsive. A fork in the XML display logic based on directory item count has been implemented, by conditionally disabling syntax highlighting for directories with more than 10000 items:
- Directories ≤ 10000 items: Full color syntax highlighting
- Directories > 10000 items: Plain text display
<root name="directory_name" text="Root directory">
<folder name="subfolder1">
<file name="file1.txt" size="1.024" modified="18/10/2024" />
<file name="file2.txt" size="2.048" modified="18/10/2024" />
<folder name="nested_folder">
<file name="nested_file.txt" size="512" modified="17/10/2024" />
</folder>
</folder>
<file name="root_file.txt" size="4.096" modified="18/10/2024" />
</xml>New Attributes:
size: File size in bytes (formatted with dot separators for thousands)modified: Last modification date in format "d/M/yyyy"
- Empty folders are included in the output with opening and closing tags but no content
- The root directory name comes from the selected folder's name
- All paths are relative to the selected root directory
- The output is always well-formed XML (assuming no file system errors)
- macOS 13.0 or later
- Xcode 15.0 or later
- Open
XMLFolderStructure.xcodeprojin Xcode - Select your target device (Mac)
- Build and run the application (⌘R)
- Click the Browse button to select a folder
- The selected directory path will appear in the text field
- Click the Generate XML button to create the XML output
- The XML structure will appear in the text area below with color-coded syntax highlighting:
- Green: XML tag names (root, folder, file)
- Purple: Attribute names (name, size, modified, text)
- Blue: Attribute values (in quotes)
- Gray: XML brackets and slashes
- Use the Export to File button to save the XML to a file (choose location and filename)
- Use the Copy to Clipboard button to copy the XML text to your clipboard
Language>Select languagein menubar or⌘ + Lkeyboard shortcut to open the language selector
Appicon based on a work by Shuvo.Das from Flaticon
MIT License - See LICENSE file for details