View list_from_folder.py
#!/usr/bin/env python
# Copyright 2016, Tianwei Shen, HKUST.
"""
A handy script to execute a command recursively in a folder,
such as 'ls' or 'rm' files.
"""
import os
View gist:db68fb6f401fe8a60586b19222d4f2b9
# some bash tricks (Ubuntu 16.04)
## show the smallest 500 files
ll | awk '{print $5" "$NF}' | sort | head -500
## if find some empty files, you can output them to a file named empty_files.txt
## then rm them using this pipe
cat empty_files.txt | awk '{print "index/"$2}' | xargs rm
## rank file size from largest to smallest and show top 100
View gist:ba6da6e692beceb4da8b4d5387a8eacc
#!/usr/bin/python
from PIL import Image
import math
test_image_list = '/home/tianwei/Data/sfm_data/test_image_list' # path to the image list
with open(test_image_list, 'r') as f:
test_images = f.readlines()
test_images = map(str.strip, test_images)