qq_42743290 2018-07-19 16:50 采纳率: 0%
浏览 1069
已结题

右键菜单修改文件名日期工具

右键菜单工具:批量把文件名后面8位的日期修改成今天的日期

谢谢~~

  • 写回答

4条回答 默认 最新

  • threenewbee 2018-07-19 17:15
    关注
     using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.IO;
    
    namespace Q695220
    {
        class Program
        {
            static void Main(string[] args)
            {
                if (args.Count() == 0) return;
                string org = args[0] = Path.GetFullPath(args[0]);
                string dt = DateTime.Now.ToString("yyyyMMdd");
                if (Regex.IsMatch(args[0], "\\d{6}"))
                    args[0] = Regex.Replace(args[0], "\\d{6}", dt);
                else
                    args[0] = Path.GetDirectoryName(args[0]) + "\\" + Path.GetFileNameWithoutExtension(args[0]) + dt + Path.GetExtension(args[0]);
                Console.WriteLine(org);
                Console.WriteLine(args[0]);
                File.Move(org, args[0]);
            }
        }
    }
    
    
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码