python clean_olddir.py放入定时任务执行就可

import os;
import time;
from datetime import tzinfo, timedelta, datetime, date;

def DeleteDirectory( dir, keep_day):
  if os.access(dir, os.F_OK) == False:
    return ;

  cur_tm   = time.time();
  cur_date = datetime.today().date();
  #print( cur_date );

  #delete the exact day file
  delta = timedelta(keep_day);
  del_date = cur_date - delta;
  fullpath  = os.path.join(dir, del_date.strftime("%Y%m%d"));
  os.system("rm -fr " + fullpath);
  #print( fullpath );
  
  for subdir in os.listdir(dir):
     fullpath = os.path.join(dir, subdir);
     si = os.lstat(fullpath); 
     cdate = date.fromtimestamp(si.st_ctime)
     if cdate + delta < cur_date:
       os.system("rm -fr " + fullpath);
       #print(fullpath);

DeleteDirectory("/home/perseus/windows", 1)
DeleteDirectory("/home/perseus/white", 1)
DeleteDirectory("/home/perseus/volte", 1)
DeleteDirectory("/home/perseus/usim", 1)
DeleteDirectory("/home/perseus/userdatatrans", 1)
DeleteDirectory("/home/perseus/user", 1)
DeleteDirectory("/home/perseus/udp", 1)
DeleteDirectory("/home/perseus/trans", 1)
DeleteDirectory("/home/perseus/traffic", 1)
DeleteDirectory("/home/perseus/smartwhite", 1)
DeleteDirectory("/home/perseus/slice", 1)
DeleteDirectory("/home/perseus/sip-telecom-5g", 1)
DeleteDirectory("/home/perseus/sip-oss-realtime", 1)
DeleteDirectory("/home/perseus/sip", 1)
DeleteDirectory("/home/perseus/s58", 1)
DeleteDirectory("/home/perseus/s11", 1)
DeleteDirectory("/home/perseus/rtmsg", 1)
DeleteDirectory("/home/perseus/restore", 1)
DeleteDirectory("/home/perseus/radius", 1)
DeleteDirectory("/home/perseus/pdd", 1)
DeleteDirectory("/home/perseus/pay", 1)
DeleteDirectory("/home/perseus/others", 1)
DeleteDirectory("/home/perseus/omuri", 1)
DeleteDirectory("/home/perseus/oap", 1)
DeleteDirectory("/home/perseus/NBIOTother", 1)
DeleteDirectory("/home/perseus/n8", 1)
DeleteDirectory("/home/perseus/n7", 1)
DeleteDirectory("/home/perseus/n5", 1)
DeleteDirectory("/home/perseus/n40", 1)
DeleteDirectory("/home/perseus/n4", 1)
DeleteDirectory("/home/perseus/n26-eversec", 1)
DeleteDirectory("/home/perseus/n26", 1)
DeleteDirectory("/home/perseus/n24", 1)
DeleteDirectory("/home/perseus/n22", 1)
DeleteDirectory("/home/perseus/n21", 1)
DeleteDirectory("/home/perseus/n20", 1)
DeleteDirectory("/home/perseus/n1n2-eversec", 1)
DeleteDirectory("/home/perseus/n1n2", 1)
DeleteDirectory("/home/perseus/n15", 1)
DeleteDirectory("/home/perseus/n14", 1)
DeleteDirectory("/home/perseus/n12", 1)
DeleteDirectory("/home/perseus/n11", 1)
DeleteDirectory("/home/perseus/n10", 1)
DeleteDirectory("/home/perseus/mqtt", 1)
DeleteDirectory("/home/perseus/media-slice-5g", 1)
DeleteDirectory("/home/perseus/media-session-5g", 1)
DeleteDirectory("/home/perseus/location", 1)
DeleteDirectory("/home/perseus/https", 1)
DeleteDirectory("/home/perseus/httpmr", 1)
DeleteDirectory("/home/perseus/httpln", 1)
DeleteDirectory("/home/perseus/httpgps", 1)
DeleteDirectory("/home/perseus/httpbody", 1) 
DeleteDirectory("/home/perseus/http", 1)
DeleteDirectory("/home/perseus/host_ip", 1)
DeleteDirectory("/home/perseus/gtpinfowhite", 1)
DeleteDirectory("/home/perseus/gtpinfo", 1)
DeleteDirectory("/home/perseus/gtp_rat", 1)
DeleteDirectory("/home/perseus/gtp", 1)
DeleteDirectory("/home/perseus/gnc", 1)
DeleteDirectory("/home/perseus/ftp", 1)
DeleteDirectory("/home/perseus/flowtype", 1)
DeleteDirectory("/home/perseus/evt", 3)
DeleteDirectory("/home/perseus/everbss", 1)
DeleteDirectory("/home/perseus/events47", 3)
DeleteDirectory("/home/perseus/events", 1)
DeleteDirectory("/home/perseus/eventcap", 1)
DeleteDirectory("/home/perseus/ert", 1)
DeleteDirectory("/home/perseus/eml", 1)
DeleteDirectory("/home/perseus/dr", 1)
DeleteDirectory("/home/perseus/dns", 1)
DeleteDirectory("/home/perseus/dnp3", 1)
DeleteDirectory("/home/perseus/dissectors", 1)
DeleteDirectory("/home/perseus/destipcap", 1)
DeleteDirectory("/home/perseus/coap", 1)
DeleteDirectory("/home/perseus/cdr", 1)
DeleteDirectory("/home/perseus/cap", 1)
DeleteDirectory("/home/perseus/cameracap", 3)
DeleteDirectory("/home/perseus/ap", 1)
DeleteDirectory("/home/perseus/ameracap", 1)
DeleteDirectory("/home/perseus/action", 1)
DeleteDirectory("/home/perseus/events57", 3)
DeleteDirectory("/home/perseus/evt57", 3)
DeleteDirectory("/home/perseus/events57zc", 3)
DeleteDirectory("/home/perseus/filter", 3)
DeleteDirectory("/home/perseus/industry", 3)
DeleteDirectory("/home/perseus/cov", 3)
DeleteDirectory("/home/perseus/iov", 3)
DeleteDirectory("/home/perseus/iiot", 3)
DeleteDirectory("/home/perseus/iovcl", 3)
DeleteDirectory("/home/perseus/iovcl138", 3)
DeleteDirectory("/home/perseus/fzclass29", 3)
DeleteDirectory("/home/perseus/business-record", 3)
DeleteDirectory("/home/newiuplog", 60)
分类: Python2

96 条评论

jewgle.me · 2026-08-30 07:46

References:

Arkansas casinos jewgle.me

https://sexvideosfree.cc/ · 2026-09-22 10:38

I’m noww nott positive thhe placxe you’re gedtting youjr
information, howver great topic. I neeeds too sped a wwhile studyying much mofe or worjing oout more.
Thank you ffor fantaqstic information I ued tto bbe oon thee lolkout foor thks informatipn forr mmy
mission. xnxx

Elena Hudson · 2026-09-22 23:57

用日期目录名按 `%Y%m%d` 计算并删除的思路很直观,配合定时任务确实方便。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,最好改用 `shutil.rmtree` 并增加路径校验。

Wyatt Tanaka · 2026-09-23 22:11

用日期格式化生成目录名再结合定时任务清理,思路很直接。建议将 os.system(“rm -fr”) 改为更安全的 shutil.rmtree,并处理路径中可能包含空格或特殊字符的情况。

Elena Brennan · 2026-09-25 04:35

用日期格式化生成目录名再执行定时清理的思路很直观,放入 cron 后维护起来也比较方便。不过 `os.system(“rm -fr ” + fullpath)` 建议改用 `shutil.rmtree`,并对路径和目录存在性做更严格的校验,避免误删。

Echeverri Sexto · 2026-09-26 05:16

用日期目录名按 `%Y%m%d` 计算清理目标很直观,配合定时任务就能自动删除过期目录。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,建议改用 `shutil.rmtree` 并先校验路径。

Simon Ingram · 2026-09-27 05:19

用 `datetime.today().date()` 计算保留日期并按 `%Y%m%d` 定位目录,思路很直观。不过 `os.system(“rm -fr ” + fullpath)` 存在路径注入和空格路径问题,建议改用 `shutil.rmtree` 并先校验目标路径。

Quinn Zhao · 2026-09-28 06:36

用日期格式化目录名再配合定时任务清理,思路很直接。不过 `os.system(“rm -fr ” + fullpath)` 如果路径包含特殊字符会有风险,建议改用 `shutil.rmtree` 并先确认目标路径。

Amara Gallagher · 2026-09-29 04:31

用日期格式化生成目录名并结合定时任务清理旧目录,思路很直接。不过 `os.system(“rm -fr ” + fullpath)` 对路径缺少校验,建议改用 `shutil.rmtree` 并确认目录确实位于指定根目录下。

Alex Whitfield · 2026-10-01 06:47

用日期格式化拼接目录名来删除过期文件,思路很直接,放进定时任务也方便。不过 `os.system(“rm -fr ” + fullpath)` 对路径中的特殊字符不够安全,建议改用 `shutil.rmtree`,并在删除前确认目标路径确实位于指定目录下。

phjoin · 2026-10-03 04:00

Hmm, this pattern analysis is interesting. The focus on immediate feedback, like in phjoin games, really speaks to behavioral loops. It’s less about luck and more about structured anticipation, I guess.

Tara Hudson · 2026-10-03 08:14

用日期格式化生成目录名再定时删除,思路很清晰,放入 cron 后基本无需人工维护。不过 `os.system(“rm -fr ” + fullpath)` 对路径中的特殊字符不够安全,最好改用 `shutil.rmtree` 并增加日志记录。

Amara Vasquez · 2026-10-04 07:41

用日期格式化生成目标目录后再执行清理,思路很直观,放进定时任务也比较方便。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,最好改用 `shutil.rmtree` 并增加目录校验。

Julia Espinoza · 2026-10-06 02:32

用日期目录名按 `%Y%m%d` 计算并删除过期目录,配合定时任务确实很方便。不过 `os.system(“rm -fr ” + fullpath)` 建议改用 `shutil`,避免路径包含特殊字符时产生安全问题。

Mei Duarte · 2026-10-08 05:51

用日期格式化生成目录名并结合定时任务清理,思路很直接。不过 `os.system(“rm -fr ” + fullpath)` 对路径不可信时有风险,建议改用 `shutil.rmtree` 并先校验目录路径。

Julia Ingram · 2026-10-09 21:45

用日期格式化目录名并结合定时任务清理的思路很实用,不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,建议改用 `shutil.rmtree` 并先校验目标目录。

https://manualshyundai.com/user/canjeep8/ · 2026-10-11 19:50

References:

Neosurf casino instant deposit australia https://manualshyundai.com/user/canjeep8/

https://hedgedoc.dawan.fr · 2026-10-11 23:40

References:

Neosurf bitcoin casino australia https://hedgedoc.dawan.fr

Julia Espinoza · 2026-10-12 08:42

按日期目录名用 `del_date.strftime(“%Y%m%d”)` 定位清理目标,思路很直接。建议将 `os.system(“rm -fr ” + fullpath)` 改为 `shutil.rmtree` 并校验路径,避免目录变量异常时误删文件。

bank transfer gambling sites australia · 2026-10-16 06:13

References:

EFT casino deposits australia bank transfer gambling sites australia

Ulises Whitfield · 2026-10-16 08:59

用日期目录名按 `%Y%m%d` 计算并删除过期目录,这种实现很直观,配合定时任务也方便部署。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,建议改用 `shutil.rmtree` 并先校验目录范围。

https://earthwiki.space · 2026-10-16 11:44

References:

Bank transfer online casino australia https://earthwiki.space

may22.ru · 2026-10-16 15:05

References:

Casino wire transfer deposit Australia may22.ru

Osko pokies licensed · 2026-10-16 16:52

References:

Payid casinos australia Osko pokies licensed

https://sonnik.nalench.com/user/foxsled77/ · 2026-10-16 21:14

References:

Best online casino that accepts mastercard canada https://sonnik.nalench.com/user/foxsled77/

ctphome.com · 2026-10-16 23:05

References:

Fast wire transfer withdrawal casino australia ctphome.com

fast withdrawal pokies australia payid · 2026-10-17 03:32

References:

Progressive jackpot payid pokies https://md.coredump.ch/aaekjd_QQiuOfRf_C7CDkg

https://md.sigma2.no · 2026-10-17 06:17

References:

Osko $10 deposit casino https://md.sigma2.no/TS5mJRCkT3OnVPrRW5UF2A

payid pokies app · 2026-10-17 11:12

References:

How to play pokies with payid http://www.automingwei.com/home.php?mod=space&uid=578891

daojianchina.com · 2026-10-17 18:44

References:

Online pokies real money payid http://daojianchina.com/home.php?mod=space&uid=1524688

australian online casino payid pokies · 2026-10-18 00:50

References:

Pokies payid accepted australia https://lslv168.com/home.php?mod=space&uid=2963191

Khaire Ardy · 2026-10-18 06:02

按日期拼接目录名并通过定时任务清理的思路很实用,不过 `os.system(“rm -fr ” + fullpath)` 对路径安全和误删风险需要特别小心,建议先确认目录范围或改用 `shutil` 删除。

https://fzquan8.cn · 2026-10-18 06:22

References:

Instant play payid pokies https://fzquan8.cn/home.php?mod=space&uid=225953

bpay VIP pokies · 2026-10-18 07:07

References:

Regulated bpay pokies https://dreevoo.com/profile.php?pid=2551940

MiFinity jackpot pokies · 2026-10-18 22:07

References:

E-wallet casinos Australia MiFinity https://school-of-safety-russia.ru/user/carcougar9/

neosurf e-voucher casino australia · 2026-10-18 23:57

References:

Neosurf casino no deposit bonus australia http://www.4001179958.org/?161191

automingwei.com · 2026-10-19 01:47

References:

Play pokies with neosurf http://www.automingwei.com/home.php?mod=space&uid=582347

neosurf casino promo code · 2026-10-19 06:23

References:

Secure neosurf casino australia https://gitlab.rails365.net/yardatom02

Mei Espinoza · 2026-10-19 07:28

用日期格式化目录名再定时删除的思路很直观,放进 cron 后维护起来也方便。不过 `os.system(“rm -fr ” + fullpath)` 对路径内容不够安全,建议改用 `shutil.rmtree`,并先确认目标路径确实位于指定目录下。

Australian bank transfer casino · 2026-10-19 16:01

References:

Australian casinos accepting wire transfers https://md.sigma2.no/DtATHWs2QMqR197c5GJtjg

https://winnipegasians.com/ · 2026-10-19 19:06

References:

Fast wire transfer casinos australia https://winnipegasians.com/home.php?mod=space&uid=248960

shareshortcuts.com · 2026-10-19 23:32

References:

Osko casino sign up https://shareshortcuts.com/u/peacelamb84

https://doc.anagora.org · 2026-10-20 04:10

References:

Aussie casinos accepting bank wire https://doc.anagora.org/Y83x1t9bSMWMCFnSeNSOeA

Paula Johansen · 2026-10-20 06:51

按日期拼接目录名并用定时任务清理的思路很实用,不过 `os.system(“rm -fr ” + fullpath)` 存在路径注入风险,建议改用 `shutil.rmtree`,并先确认目标路径确实位于指定目录下。

https://hedgedoc.dawan.fr/qu0vbPcOTIqZtEY9p2azGA · 2026-10-20 07:39

References:

Wire transfer casino gambling Australia https://hedgedoc.dawan.fr/qu0vbPcOTIqZtEY9p2azGA

lslv168.com · 2026-10-20 16:46

References:

Payid osko instant pokies https://lslv168.com/home.php?mod=space&uid=2974061

Felix Vasquez · 2026-10-20 21:02

用日期目录名计算保留天数的思路很直观,放入定时任务后维护起来也方便。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径有风险,建议改用 `shutil.rmtree` 并先确认路径确实位于目标目录下。

https://gitlab.herzog-it.de/ · 2026-10-21 00:35

References:

Live wire transfer casino australia https://gitlab.herzog-it.de/gumriver74

http://git.yang800.cn/northspike7 · 2026-10-21 09:28

References:

Instant BPay casino deposit http://git.yang800.cn/northspike7

bestcomedy.ru · 2026-10-21 13:50

References:

Payid online pokies https://www.bestcomedy.ru/user/mittengerman7/

online pokies payid · 2026-10-21 19:17

References:

Payid minimum deposit pokies https://hedgedoc.dawan.fr/km5Vkyw3S-Ss1lDObFkCUw

VIP MiFinity casino Australia · 2026-10-21 21:38

References:

Offshore MiFinity casinos Australia https://dok.kompot.si/5SR8qXciQj2BDRDmGoJOWA

Felix Vasquez · 2026-10-21 21:47

用 `datetime.today().date()` 配合 `timedelta` 计算清理日期的思路很直观,按 `%Y%m%d` 拼接目录名也适合定时任务场景。不过 `os.system(“rm -fr ” + fullpath)` 最好改用 `shutil.rmtree`,并增加路径校验,避免路径异常导致误删。

https://pad.stuve.de · 2026-10-22 00:00

References:

MiFinity casino KYC Australia https://pad.stuve.de/MaUKnjZjTR2ce_KZJgAMsQ

free chips neosurf casino australia · 2026-10-22 08:08

References:

Neosurf casino banking australia https://myspace.com/wordcheek7

xtuml.org · 2026-10-22 09:15

References:

Neosurf voucher online casino https://xtuml.org/author/walletwarm3/

real money pokies app neosurf · 2026-10-22 14:24

References:

Top neosurf online casinos australia https://www.akaqa.com/account/profile/19192104024

https://codimd.camba.coop/ · 2026-10-22 21:15

References:

Wire transfer casino sites australia https://codimd.camba.coop/u3os-69PTWmb8sURtCRynQ

http://qiaoxiaojun.vip/ · 2026-10-22 21:22

References:

Best bank wire casinos australia http://qiaoxiaojun.vip/home.php?mod=space&uid=2770199

Simon Pennington · 2026-10-22 22:40

用日期目录名计算保留天数的思路很直接,放入定时任务后维护起来也方便。不过 `os.system(“rm -fr ” + fullpath)` 直接拼接路径存在风险,建议改用 `shutil.rmtree` 并做好路径校验。

www.pshunv.com · 2026-10-23 07:46

References:

New wire transfer casinos australia http://www.pshunv.com/space-uid-1056921.html

daojianchina.com · 2026-10-23 08:23

References:

Osko pokies $10 deposit http://daojianchina.com/home.php?mod=space&uid=1542091

vnnh555 · 2026-10-23 09:23

Been playing here for a few weeks and the game variety keeps getting better. Withdrawals clear without any unnecessary paperwork and the daily cash drops make the experience even more rewarding. It feels like a premium lounge that genuinely cares about fair play. Give it a spin and join the fun. vnnh555

bank transfer gambling sites australia · 2026-10-23 17:50

References:

Wire transfer casino AUD https://gitlab.ujaen.es/refundcolumn48

hedgedoc.uni-ak.ac.at · 2026-10-23 20:09

References:

Is Osko safe for online pokies https://hedgedoc.uni-ak.ac.at/J67Qe5F7Qa-NX3v4r5Htxg

https://pad.nixnet.services · 2026-10-23 20:31

References:

Instant withdrawal pokies Australia https://pad.nixnet.services/L_9EiX7jTtGifAHH2Zu_MA

https://www.1v34.com/ · 2026-10-23 22:30

References:

Payid pokies app https://www.1v34.com/space-uid-1848604.html

Nina Quiroga · 2026-10-24 07:39

用 datetime 计算保留天数并按 %Y%m%d 拼接目录名的思路很直观,放入定时任务后确实方便自动清理。不过 os.system(“rm -fr ” + fullpath) 对路径安全性要求较高,最好改用 shutil.rmtree 并先确认目标目录范围。

发表回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注