static void RenameFiles()
{
string sourceDir = @"D:\ll";
string[] allFiles = Directory.GetFiles(sourceDir, "*.mp3", SearchOption.AllDirectories); if(allFiles!=null && allFiles.Any())
{
for(int i = ; i < allFiles.Count(); i++)
{
string newName =Path.Combine(sourceDir, i + ".mp3");
File.Move(allFiles[i], newName);
}
}
}

C# rename files的更多相关文章

  1. Rename in Batch [Python]

    #!/usr/bin/python2.7 # Program: # Rename files in current folder in batch. # Date: # 2016-04-17 # Us ...

  2. Files and Directories

    Files and Directories Introduction     In the previous chapter we coveredthe basic functions that pe ...

  3. 【原】The Linux Command Line - Manipulation Files And Directories

    cp - Copy Files and directories mv - move/rename files and directories mkdir - create directories rm ...

  4. Notes for Apue —— chapter 4 Files and Directories(文件和目录)

    4.1 Introduction 4.2 stat, fstat, fstatat, and lstat Functions The lstat function is similar to stat ...

  5. Linux下的rename命令

    Dos/Windows下,对文件改名用rename.而书上说,Linux下对文件或目录改名该用mv.我一直也是这样做的,却忽略了Linux下也有个叫rename的命令.都是rename,但功能上就有点 ...

  6. shell rename directory

    mv can do two jobs. It can move files or directories It can rename files or directories To just rena ...

  7. Linux命令之rename

    一.引言 今天才知道Linux下的rename有两个版本,util-linux工具集的rename和Perl版本的rename,而两者的用法是明显不一样的,Perl版rename相对比较强大 二.对比 ...

  8. Manipulating Files

    http://linuxcommand.org/lc3_lts0050.php This lesson will introduce you to the following commands: cp ...

  9. [Bash] Move and Copy Files and Folders with Bash

    In this lesson we’ll learn how to move and rename files (mv) and copy (cp) them. Move index.html to ...

随机推荐

  1. java之包装类

    针对八种基本数据类型定义相应的引用类型--包装类: 有了类的特点,接可以调用类中的方法: 基本数据类型 包装类 boolean Bollean byte Byte short Short int In ...

  2. 一文带你深入浅出Spring 事务原理

    Spring事务的基本原理 Spring事务的本质其实就是数据库对事务的支持,没有数据库的事务支持,spring是无法提供事务功能的.对于纯JDBC操作数据库,想要用到事务,可以按照以下步骤进行: 获 ...

  3. IDEA 护眼色设置

    首先做一些简单的记录,护眼色 等等的设置很久以前机器上已经设置过了,今天偶尔要在其他机器上重新做一些设置反而忘记了很多步骤, 设置后的HTML页面如下图所示: 默认情况下,当只是设置General通用 ...

  4. RocketMQ 升级到主从切换(DLedger、多副本)实战

    目录 1.RocketMQ DLedger 多副本即主从切换核心配置参数详解 2.搭建主从同步环境 3.主从同步集群升级到DLedger 3.1 部署架构 3.2 升级步骤 3.3 验证消息发送与消息 ...

  5. 签名时出错: 未能对** SignTool Error:

    项目在vs2010创建,在2017上运行时报签名时出错.......... 解决方法: 右键项目 - 属性-签名 -  创建测试证书 - 密码可以为空-确定

  6. C++利用宏实现变量交换的三种方式

    #include <iostream> using namespace std; //引入中间变量 #define SWAP1(a,b) {int tmp=a;a=b;b=tmp;} // ...

  7. MySQL之架构简单分析

    上图为MySQL的简易架构图,给您有一个大概的概念,下面我将为您进行进一步的分析. 连接器: 当连接MySQL数据库时,等待的将是MySQL服务端的连接器:连接器的职责是和客户端建立连接.获取权限.维 ...

  8. Centos7.6 Apache 虚拟机禁止访问IP,允许访问多域名多个虚拟目录设置

    存放配置文件路径 /etc/httpd/conf.d自定义命名,配置文件后缀格式确保 *.conf注:这是两个配置文件,也是两种方法. # 一个WEB目录# 禁止以IP地址形式访问<Virtua ...

  9. CentOS安装docker-compose

    一.compose简介 compose是一个定义和运行多容器的docker应用的工具.compose 通过yaml文件配置应用服务,然后仅需一个命令就可以创建和运行所有配置中的服务. 二.compos ...

  10. Python 获 Mozilla 和扎克伯格夫妇 40 余万美金资助

    Python 软件基金会近日发文宣布,收到来自 Mozilla Corporation 和 Chan Zuckerberg Initiative(CZI)的资金赞助,共计 407,000 美元.这笔款 ...