29 lines
876 B
Python
29 lines
876 B
Python
#!/usr/bin/env python3
|
|
"""Count Python files in /root using find command for authoritative count."""
|
|
import subprocess
|
|
import json
|
|
|
|
# Use find command directly
|
|
result = subprocess.run(['find', '/root', '-name', '*.py'], capture_output=True, text=True)
|
|
find_files = result.stdout.strip().split('\n')
|
|
find_count = len(find_files)
|
|
sample_files = find_files[:10]
|
|
|
|
print(f"Python files found by 'find /root -name *.py': {find_count}")
|
|
print(f"Sample files (first 5):")
|
|
for f in sample_files[:5]:
|
|
print(f" {f}")
|
|
|
|
# Save the result
|
|
output = {
|
|
'count': find_count,
|
|
'sample_files': sample_files,
|
|
'method': 'find /root -name "*.py"'
|
|
}
|
|
|
|
result_path = '/root/.hermes/wizard-outputs/spark/python_count_result.json'
|
|
with open(result_path, 'w') as f:
|
|
json.dump(output, f, indent=2)
|
|
|
|
print(f"\nResult saved to: {result_path}")
|
|
print(f"Total count verified: {find_count}") |