简体   繁体   中英

Remove colon from file name

I have a number of PNGs with a colon in the name on a Windows computer. 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. For example "NamePart1: NamePart2.png"

This is showing up in Windows as "NamePart1" with no file extension. Windows reads the file as being 0 bytes, though it does recognize that the file takes up space on the hard drive.

What I've tried:

  • Renaming the file in explorer to add a ".png" on the end of the abbreviated name. This results in an empty png.
  • Renaming via cmd using this structure: 'rename "NamePart1? NamePart2.png" name.png'
  • Copying the file and opening it on a Mac
  • Duplicating the drive onto a linux machine to see if the files open there. The file names are all still incorrect on Linux.

Anyone have ideas on how to resolve?

I had the same problem with files created by my 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
  2. in the Dos window go to the directory with the problem files (example: X: [return], cd\\problemdirectory\\ [return])
  3. List the short names for the directory contents (dir/x [return])
  4. The problem files will appear as proble~1.xxx etc.
  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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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