imdb-rename icon indicating copy to clipboard operation
imdb-rename copied to clipboard

Attempts to rename files with colon (:), not possible in windows. os error 123

Open iStruggle opened this issue 4 years ago • 4 comments

Love the tool, trying to get it to loop through my media folder with a basic For loop in cmd. Works well for the most part, so thankyou!

Am running in silent mode with "echo y" prefix in a batch file. Sometimes (correctly) tries to rename to include a colon, which is not allowed in windows paths.

Possibly replace with '-', or simply a space?

iStruggle avatar May 18 '20 19:05 iStruggle

On linux colons are not illegal chars, but when imdb-rename tries to rename a file containing a colon...

Thor.Ragnarok.2017.720p.mp4' to 'Thor: Ragnarok (2017).mp4'

Returns an error: Invalid argument (os error 22)

vredesbyyrd avatar Nov 05 '20 22:11 vredesbyyrd

On Linux, the restriction is tied to the filesystem:

ubuntu@thinkgrunge:~$ lsblk -no name,fstype /dev/sdb1
sdb1 ntfs
ubuntu@thinkgrunge:~$ touch /media/ubuntu/Hitachi/foo:bar
touch: setting times of '/media/ubuntu/Hitachi/foo:bar': No such file or directory

It works fine on more native filesystems like tmpfs and ext4:

ubuntu@thinkgrunge:~$ touch /tmp/foo:bar ~/foo:bar
ubuntu@thinkgrunge:~$ 

The simplest solution is to just replace the colon with something else that won't break other matchers.

kikoreis avatar Feb 20 '21 00:02 kikoreis

The way I get around this is I have a config file that contain character replacements:

title_tr:
  ":": "꞉"
  "*": "∗"
  "?": "﹖"
  "/": "∕"
  "\\": "⧵"
  "|": "ǀ"
  "[": "["
  "]": "]"
  "  ": " "
    let new_title = {
      let mut tmp = String::from(&results[my_index].title);
      for (k, v) in &CONFIG.title_tr {
        tmp = tmp.replace(k, v);
      }
      tmp.trim().to_string()
    };

mabushey avatar Feb 01 '23 23:02 mabushey

How are you implementing the title changes? i know you said via a config file (config.ini)? I'm on windows and have this exact issue renaming files. Any help would be great

hmartin417 avatar Dec 13 '23 00:12 hmartin417