util-文件移动

uibot的练习:获取指定目录下所有的文件夹及文件,数据库,执行JS 立即下载

遍历一个文件夹下的所有whl和gz文件,移动到另外一个文件夹 ,并删除原文件夹下的空文件夹

import os
import shutil

def get_all_folders(base_dir):
    file_list = []
    folder_list = []
    for root,dir_names,file_names in os.walk(base_dir):

        for dir_name in dir_names:
            dir_path = os.path.join(root,dir_name)
            folder_list.append(dir_path)

        for file_name in file_names:
            file_path = os.path.join(root,file_name)
            file_list.append(file_path)
    
    return folder_list

def get_all_files(base_dir):
    file_list = []
    folder_list = []
    for root,dir_names,file_names in os.walk(base_dir):

        for dir_name in dir_names:
            dir_path = os.path.join(root,dir_name)
            folder_list.append(dir_path)

        for file_name in file_names:
            file_path = os.path.join(root,file_name)
            file_list.append(file_path)
    
    return file_list

def remove_empty_folder(folder_path):
    if len(os.listdir(folder_path)) == 0:
        os.rmdir(folder_path)

if __name__ =="__main__":
    
    base_dir = "/home/wzg/data2/pypi-package-test/"
    aim_dir = "/home/wzg/data2/pypi-packages/"

    # 获取所有文件
    file_list = get_all_files(base_dir)
    # 遍历文件,判断是否符合要求,
    for file_path in file_list:
        file_name = os.path.split(file_path)[-1]
        # print(file_name)
        file_type = file_name.split(".")[-1]
        # print(file_type)
        if file_type in ["whl","gz"]:
            aim_path = os.path.join(aim_dir,file_name)
            shutil.move(file_path,aim_path)
        #     print(file_path)

    # 遍历base_dir内的所有文件夹,删除空文件夹
    folder_list = get_all_folders(base_dir)
    for folder_path in folder_list:
        # print(folder_path)
        remove_empty_folder(folder_path)

实时获取打开的所有文件夹路径 实时获取所有打开的文件夹路径,支持xp、win7、win8、win10等系统 立即下载

相关推荐

fileutil文件通用类

通用文件方法,方发都很通用,在java中这些都是常用的

util-遍历一个文件夹下的所有文件夹和文件

【代码】util-遍历一个文件夹下的所有文件夹和文件。

wzg2016的博客 400

livebos报表开发

文章目录1.参数的设定2.展示的内容3.综合展示的效果4.调用过程5.可以在数据库里面查看6.注意事项7.过程代码 1.参数的设定 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-flb5C49A-1619516341977)(/uploads/xinxibuneibuzhishiku/images/m_bc71bb4608053778dbf29e06cd102ae1_r.png)] 2.展示的内容 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-

阿浪的专栏 709

util文件的作用

经常在程序里见到 Util ,例如,util.py

xumesang的专栏 1万+

基于555定时器的D类功放设计:从PWM原理到无反馈电路实践

D类功放(数字功放)是一种高效率的音频放大技术,其核心原理是脉冲宽度调制(PWM)。它将输入的模拟音频信号转换为一系列高速开关的脉冲,通过控制功率开关管(如MOSFET)的通断,再经低通滤波器还原放大后的音频。相比传统AB类功放,其转换效率通常超过90%,显著降低了热能损耗。这项技术在追求高能效和小型化的现代音频设备中价值凸显,广泛应用于有源音箱、汽车音响和便携式设备。本文聚焦于一种独特的实现方案:以经典的555定时器芯片为核心,构建一个无整体负反馈的D类功放。通过剖析其PWM调制器、FET电压-电流转换级

weixin_30162121的博客 221

能量机关 STM32HAL库开发大疆A板WS2812B彩灯(PWM+DMA)

本文主要目的是为了制作RoboMaster比赛能量机关的灯条控制,模拟比赛场中大符,搭建出类似场地道具,以供视觉测试 使用的是RoboMaster开发板A型,芯片为STM32F427IIH6,使用的灯条为WS2812B。 采用PWM+DMA控制,使用CUBEMX配置底层,keil5编辑烧录代码 实现:一共五片扇叶,每片扇叶均实现流水灯+常亮颜色 参考文章在后面会标记出来

m0_51756449的博客 4290

Spring Util、entity、model、DAO、DTO、view、mapper、service、controller文件夹用途

Spring Util、entity、model、DAO、DTO、view、mapper、service、controller用途

baishi1987的专栏 3635

ArcGIS Pro2.5深度学习使用注意事项

ArcGIS Pro2.5深度学习使用中的注意事项1、ArcGIS Pro2.5深度学习使用中的注意事项1.1、Label深度学习样本工具参数介绍1.2、准备数据参数介绍1.3、训练模型介绍1.4、ArcGIS Pro2.5深度学习推理工具和模型对应关系介绍1.4.1、Classify Objects Using Deep Learning1.4.2、Classify Pixels Using D...

GIS哼哈哈的博客 7200

python文件传输进度条_Python复制和移动文件的进度条

我创建了一个程序,复制和移动文件到不同的方向。我想在整个过程中添加一个进度条会很有趣。我该如何处理?在我的剧本多做几点思考:将没有.mdi文件的文件排序到“missing mdi”文件夹我用过distutils.dir\u util。复制树是因为shutil.copytree公司acces有问题src = raw_input("Enter source disk location: ")src =...

weixin_39620252的博客 1437

基于STM32L4XX、HAL库的AP6275S WIFI 模块驱动程序设计

支持802.11a/b/g/n/ac/ax (Wi-Fi 6)标准。// 这部分通常依赖于Broadcom提供的固件和驱动。// 这里需要添加Wi-Fi固件加载和初始化的代码。// 通常需要通过SDIO发送命令和接收响应。// 这里需要添加蓝牙HCI初始化代码。// 处理Wi-Fi和蓝牙数据。// 这里需要实现Wi-Fi连接逻辑。// 初始化SDIO和UART。// 确保蓝牙使能引脚已设置。// 关闭Wi-Fi和蓝牙。// 关闭Wi-Fi和蓝牙。// 打开Wi-Fi和蓝牙。// 初始化AP6275S。

zhusl6688的博客 275

华为OD机试真题 新系统【网络数据包收发处理】

华为OD机试 新系统真题【网络数据包收发处理】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【网络数据包收发处理】多语言题解。

qq_45776114的博客 444

python创建文件夹 覆盖,Python-移动和覆盖文件和文件夹

I have a directory, 'Dst Directory', which has files and folders in it and I have 'src Directory' which also has files and folders in it. What I want to do is move the contents of 'src Directory' to '...

weixin_42117082的博客 212

SAP FICO 内部往来对账功能开发说明书(包括测试样例、程序代码仅作参考,不保证一定可以运行)

SAP FICO 内部往来对账功能开发说明书(包括开发源代码、测试样例、FS)

我好像病了的博客 1223

python创建文件夹 覆盖_Python-移动和覆盖文件和文件夹

I have a directory, 'Dst Directory', which has files and folders in it and I have 'src Directory' which also has files and folders in it. What I want to do is move the contents of 'src Directory' to '...

weixin_39820910的博客 673

晶闸管选型参数,结构原理,工艺与注意问题总结

闸管(Thyristor)是一种半导体开关器件,也被称为可控硅整流器(SCR, Silicon Controlled Rectifier)。它可以在高电压和大电流条件下工作,常被用于交流电的控制和整流。本文对晶闸管的工作原理,结构特点,工艺流程,选型参数及设计注意事项进行总结。

fydar的博客 1281

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

nodejs fs.renameSync(files.upload.path, "/tmp/test.png");解决

nodejs 跨区操作文件时,出现错误 fs.renameSync return binding.rename(pathModule._makeLong(oldPath), ^ Error: EXDEV, cross-device link not permitted 'C:\Users\LIUJIA~1\AppData\Local\Temp\upload_58c5fbc8c804174256ce2826d766bb0a'

蜗牛快跑 3242

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

一个项目两套路由(pc端和移动端)

移动端项目配置

weixin_47454566的博客 257

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[转]Unity-移动设备可用的压缩解压缩源码

原文:http://www.manew.com/thread-103250-1-1.html 最近在做客户端数据的分离,不希望对项目有什么影响,也不太想用AssetBundle,太麻烦,就在网上找了找开源的C#压缩算法,找来找去,发现不是不支持移动端,就是不能直接压缩文件夹,总之没有一个满意的方案,最后还是找了开源的ICSharpCode.SharpZipLib.Zip的源码,调试了一...

weixin_30632883的博客 126

vue里px转rem,适用于移动端

vue里px转rem,适用于移动端 1.下载lib-flexible 我使用的是vue-cli+webpack,所以是通过npm来安装的 npm i lib-flexible --save 2.引入lib-flexible 在main.js中引入lib-flexible import 'lib-flexible/flexible' 3.设置meta标签 通过meta标签,设置设备宽度以及缩放比...

qq_41241767的博客 275

针对移动端的前端工作流(7)—WeUI样式的loading和dialog组件 96 冴羽 关注 2016.10.13 20:10 字数 273 阅读 1018评论 0喜欢 1 有这个需求 因为移动

针对移动端的前端工作流(7)—WeUI样式的loading和dialog组件 冴羽 关注2016.10.13 20:10 字数 273 阅读 1018评论 0喜欢 1有这个需求因为移动端项目多用于微信端,所以我们用微信官方团队提供的WeUI样式简单封装了两个常用的插件,一个是loading组件,另一个是dialog组件dialog组件首先介绍的dialog组件,包含alert和confirm两种样...

abcde158308的博客 628

Mac,Windows和Linux系统都能读写移动硬盘的方法

Mac,Windows和Linux系统都能读写移动硬盘的方法 前言 Windows和Linux都支持NTFS文件格式。但可能是因为存在版权的问题,Mac不支持NTFS文件系统格式。 我之前的移动硬盘是希捷的。而希捷移动硬盘自带正版的Seagate Expansion程序。只要在Mac系统上安装Seagate Expansion程序,Mac就能支持NTFS文件系统格式。 然而,Seagate Expansion程序只认希捷的移动硬盘,其他厂商的移动硬盘,即使是NTFS文件系统格式的,Mac系统依然无法识别。

【良少课堂】 1万+

kotlin学习笔记——扩展函数

用户类User class User(var name:String, var age:Int) { } 复制代码在Util.kt文件中为User类增加一个save()函数 /** * 扩展函数:保存用户信息 */ fun User.save():Boolean{ //this指的就是调用者:User val name=this.name val age=this.a...

weixin_33860553的博客 113

vue-cli脚手架移动端适配rem

1、下载两个依赖 npm install lib-flexible --S npm install px2rem-loader -S 2、在main.js中引入lib-flexible import 'lib-flexible/flexible' 3、配置px2rem-loader 在build文件中找到util.js,将px2rem-loader添加到cssLoaders中,如: const px2remLoader = { loader: 'px2rem-loader', opti

帥潔的博客 279

IDEA 配置文件 properties.load(inputstream) NullPOINTEXCEPTION:create breakpoint解决

NULLPOINTEXCEPTION:create breakpoint解决方法

weixin_48205264的博客 2763

Android.util.Xml类

在Android API中,提供了Android.util.Xml类,同样可以解析XML文件,使用方法类似于SAX,也是需要编写Handler来处理XML的解析,但是在使用上比SAX来的简单。 [java] view plaincopy android.util.Xml.parse(url.openConnection().getInputStr

483
上一篇: util-遍历一个文件夹下的所有文件夹和文件
下一篇: 科研绘图--pdf图像去除空白
wzg2016
博客等级 码龄10年 539粉丝 493原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值