Moving manage and moving unique files
parent
6b916d4e4b
commit
ec4acbd78b
|
@ -0,0 +1,46 @@
|
||||||
|
import pathlib
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
from media import Media
|
||||||
|
|
||||||
|
def find_all_files(directory: pathlib.Path):
|
||||||
|
ps = []
|
||||||
|
for p in directory.rglob('*'):
|
||||||
|
if "eaDir" not in str(p):
|
||||||
|
ps.append((p))
|
||||||
|
return ps
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser(description='convert hardlink to symlink in download folder')
|
||||||
|
|
||||||
|
parser.add_argument('Library',
|
||||||
|
metavar='--library',
|
||||||
|
type=str,
|
||||||
|
help='the path to library')
|
||||||
|
|
||||||
|
parser.add_argument('Inventory',
|
||||||
|
metavar='--inventory',
|
||||||
|
type=str,
|
||||||
|
help='the path to inventory for non-repeatable videos')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
path_library = args.Library
|
||||||
|
path_inventory = args.Inventory
|
||||||
|
paths = find_all_files(pathlib.Path(path_library))
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
for x in paths:
|
||||||
|
if x.lstat().st_size > 50 * 1024 * 1024:
|
||||||
|
if x.lstat().st_nlink == 1:
|
||||||
|
print("File with only one hardlink:" + str(x) + "; size: " +
|
||||||
|
str(x.lstat().st_size/1024/1024) +
|
||||||
|
"MB with number of links: " + str(x.lstat().st_nlink))
|
||||||
|
else:
|
||||||
|
print("File with more than one hardlink:" + str(x) + "; size: " +
|
||||||
|
str(x.lstat().st_size/1024/1024) +
|
||||||
|
"MB with number of links: " + str(x.lstat().st_nlink))
|
||||||
|
|
||||||
|
# dst_path = pathlib.Path(os.path.join(path_inventory,x.name))
|
||||||
|
# print("Its new path: " + str(dst_path))
|
||||||
|
# x.link_to(dst_path)
|
Loading…
Reference in New Issue