python 把文件夹压缩成tar,pythontar,import tarfi
python 把文件夹压缩成tar,pythontar,import tarfi
import tarfileimport osimport sysuser = os.getenv('USERNAME')filename = '/home/%s/tmp.tgz' % userprint 'The tar file was created here: %s' % filenamemode = 'w:gz'file = tarfile.open( filename, mode )file.add( '/var/log/auth.log' )file.add( '/var/log/messages' )file.close()print 'done'
相关内容
- python控制shell执行时间,若超时则强行推出,pythonshel
- python登录Discuz!类型论坛的通用代码,pythondiscuz,[Python
- 使用python杀死进程,python杀死进程,使用python脚本根据
- python实现的线程池,python实现线程池,python实现的线程池
- python显示用户友好的时间,python用户,def time_spa
- 用Python在windows命令行输出彩色字符,python命令行,[Pyt
- python 修饰器Decorator原理解密,pythondecorator,如果你看过
- 自定义DJango分页类实现,自定义django分页,感觉DJango的分
- python使用gzip库压缩文件,,python的标准库里有
- python正则查找所有匹配的字符串,python匹配字符串,im
评论关闭