简体   繁体   English

从文件名中删除冒号

[英]Remove colon from file name

I have a number of PNGs with a colon in the name on a Windows computer. 我在Windows计算机上的名称中有许多带有冒号的PNG。 Long story short, this is due to a bug in the program I'm using to generate the images. 长话短说,这是由于我用来生成图像的程序中的错误所致。 Since this issue applies to a lot of images and a lot of work, redoing them will be a problem. 由于此问题适用于大量图像和大量工作,因此重做它们将是一个问题。

The problem - the pngs were generated with a colon in the name. 问题-png是用名称中的冒号生成的。 For example "NamePart1: NamePart2.png" 例如“ NamePart1:NamePart2.png”

This is showing up in Windows as "NamePart1" with no file extension. 这在Windows中显示为“ NamePart1”,没有文件扩展名。 Windows reads the file as being 0 bytes, though it does recognize that the file takes up space on the hard drive. Windows读取文件为0字节,尽管它确实识别出该文件已占用硬盘驱动器上的空间。

What I've tried: 我尝试过的

  • Renaming the file in explorer to add a ".png" on the end of the abbreviated name. 在资源管理器中重命名文件以在缩写名称的末尾添加“ .png”。 This results in an empty png. 这将导致一个空的png。
  • Renaming via cmd using this structure: 'rename "NamePart1? NamePart2.png" name.png' 使用以下结构通过cmd重命名:'rename“ NamePart1?NamePart2.png” name.png'
  • Copying the file and opening it on a Mac 复制文件并在Mac上打开
  • Duplicating the drive onto a linux machine to see if the files open there. 将驱动器复制到linux机器上,查看文件是否在那里打开。 The file names are all still incorrect on Linux. 在Linux上,文件名仍然不正确。

Anyone have ideas on how to resolve? 有人对解决方法有想法吗?

I had the same problem with files created by my PVR. 我的PVR创建的文件存在相同的问题。 The solution, long-winded but it works: 该解决方案,绕了一步,但它可以起作用:

  1. start command.com (not cmd.exe, you may have to search for this, it may be in \\windows\\system32) this opens a Dos window 启动command.com(不是cmd.exe,您可能需要搜索它,可能在\\ windows \\ system32中),这会打开Dos窗口
  2. in the Dos window go to the directory with the problem files (example: X: [return], cd\\problemdirectory\\ [return]) 在“ Dos”窗口中,转到包含问题文件的目录(例如:X:[return],cd \\ problemdirectory \\ [return])
  3. List the short names for the directory contents (dir/x [return]) 列出目录内容的简称(dir / x [返回])
  4. The problem files will appear as proble~1.xxx etc. 问题文件将显示为问题〜1.xxx等。
  5. Type "rename proble~1.xxx fixed1.xxx" [return] Important: to generate the ~ character in the dos window enter "Alt 126" (hold down the alt key whilst typing 1 then 2 then 6, then release the Alt key) 键入“ rename proble〜1.xxx fixed1.xxx” [返回]重要说明:要在dos窗口中生成〜字符,请输入“ Alt 126”(按住alt键的同时输入1、2、6,然后释放Alt键)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM