Last active
August 8, 2018 16:43
-
-
Save deeuu/32a1ab4dd912d66f2b607b20bafa1a9f to your computer and use it in GitHub Desktop.
xonsh script to list all directories on a remote that do not contain files (but may contain folders), via rclone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
rclone_remote_path = 'drive:/temp' | |
dirs = re.findall('\d+:\d+:\d+\ +-1\ +(.*?)\n', | |
$(rclone lsd -R @(rclone_remote_path))) | |
file_dirs = re.findall('\d+\ +(.*\/?(?=\/))', | |
$(rclone ls @(rclone_remote_path))) | |
print('~~ Directories with no files ~~') | |
empty_dirs = set(dirs) - set(file_dirs) | |
for _ in empty_dirs: | |
print(_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment