Created
March 7, 2016 22:11
-
-
Save Mahdisadjadi/908f87e10735295aafe4 to your computer and use it in GitHub Desktop.
Delete files when list of names is in a file
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
# This removes files where paths are listed in a file named "file.dat". | |
# for running, type: | |
# python3 script.py file.dat | |
import sys | |
import os | |
paths = sys.argv[1] | |
with open(paths) as f: | |
for line in f: | |
os.remove(line.rstrip('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment