I made a script with python that creates placeholders in all empty directories so that they wont get deleted.
The problem with that is: it detects symlinks which I do not want to happen.
and I am getting error like: PermissionError: [Errno 13] Permission denied: 'system/d/'
code:
#!/usr/bin/env python3
import os, glob
dirs = []
paths = ["system", "vendor"]
for path in paths:
dirs.append(glob.glob(path + '/**/', recursive=True))
for dir in dirs:
for dir1 in dir:
if len(os.listdir(dir1)) == 0:
open(dir1, '.PLACEHOLDER').close()
else: continue
How do i ignore symlinks