FaTe Fx
2021-04-08T16:38:26+00:00
写完一看贴子没了[s:ac:汗]
也不知道你弄好了没
写都写完了,还是发出来吧
python3写的
不知道mac os 现在自带pthon3不
保存成move.py放到你照片的文件夹里
然后打开console cd文件夹到你的照片文件夹里
再输入python3 move.py
再回车
如果能顺利运行,会叫你输入一个日期时间
也就是你复制的文件的时间点
小于这个时间点的文件都会 复制 移动到一个新建的文件夹origin里面去
我在windows测试了,mac os 没试
也不知道你弄好了没
写都写完了,还是发出来吧
python3写的
不知道mac os 现在自带pthon3不
import time
import os
import shutil
def mov_file(time_point):
files = os.listdir(os.getcwd())
if not os.path.exists('origin'):
os.mkdir('origin')
file_count = len(files)
done_counter = 0
for f in files:
if os.path.isfile(f):
if os.path.getctime(f) < time_point:
try:
_, fname = os.path.split(f)
dst_file = './origin/' + fname
shutil.move(f, dst_file)
except Exception as e:
print('Error! Move file {} failure!'.format(fname))
continue
done_counter += 1
done_percent = done_counter / file_count
print(f'Work in progress ..... {done_percent:2.4f} %done ')
if __name__ == '__main__':
while True:
time_point_str = input("please input the time point(yyyy-mm-dd hh:mm:ss):")
try:
time_point = time.mktime(time.strptime(time_point_str, '%Y-%m-%d %H:%M:%S'))
break
except:
print('Wrong time format!')
continue
mov_file(time_point)
print('all work done.')
编辑器里新建个文件 复制过去import os
import shutil
def mov_file(time_point):
files = os.listdir(os.getcwd())
if not os.path.exists('origin'):
os.mkdir('origin')
file_count = len(files)
done_counter = 0
for f in files:
if os.path.isfile(f):
if os.path.getctime(f) < time_point:
try:
_, fname = os.path.split(f)
dst_file = './origin/' + fname
shutil.move(f, dst_file)
except Exception as e:
print('Error! Move file {} failure!'.format(fname))
continue
done_counter += 1
done_percent = done_counter / file_count
print(f'Work in progress ..... {done_percent:2.4f} %done ')
if __name__ == '__main__':
while True:
time_point_str = input("please input the time point(yyyy-mm-dd hh:mm:ss):")
try:
time_point = time.mktime(time.strptime(time_point_str, '%Y-%m-%d %H:%M:%S'))
break
except:
print('Wrong time format!')
continue
mov_file(time_point)
print('all work done.')
保存成move.py放到你照片的文件夹里
然后打开console cd文件夹到你的照片文件夹里
再输入python3 move.py
再回车
如果能顺利运行,会叫你输入一个日期时间
也就是你复制的文件的时间点
小于这个时间点的文件都会
我在windows测试了,mac os 没试