Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Nonexisting input files. Aborting. #45

Closed
lamyergeier opened this issue Apr 15, 2022 · 5 comments
Closed

Error: Nonexisting input files. Aborting. #45

lamyergeier opened this issue Apr 15, 2022 · 5 comments

Comments

@lamyergeier
Copy link

lamyergeier commented Apr 15, 2022

Error is shown even if file exists!

$ ls
PARSIFAL - Bavarian State Opera-1.mp4  PARSIFAL - Bavarian State Opera-3.mp4
PARSIFAL - Bavarian State Opera-2.mp4  PARSIFAL - Bavarian State Opera.mp4
$ ls | renamer 
The following input files do not exist:
PARSIFAL - Bavarian State Opera-1.mp4  PARSIFAL - Bavarian State Opera-3.mp4
PARSIFAL - Bavarian State Opera-2.mp4  PARSIFAL - Bavarian State Opera.mp4

Error: Nonexisting input files. Aborting.
$ ls -la
total 573M
664 -rw-rw-r-- 1 nikhil nikhil 123M 2022-04-15 19:57 PARSIFAL - Bavarian State Opera-1.mp4
664 -rw-rw-r-- 1 nikhil nikhil 123M 2022-04-15 19:57 PARSIFAL - Bavarian State Opera-2.mp4
664 -rw-rw-r-- 1 nikhil nikhil 169M 2022-04-15 19:57 PARSIFAL - Bavarian State Opera-3.mp4
664 -rw-rw-r-- 1 nikhil nikhil 161M 2022-04-15 19:41 PARSIFAL - Bavarian State Opera.mp4
$  renamer  *.mp4
Error: No replacements found
@mtimkovich
Copy link
Collaborator

Would you happen to be on FreeBSD?

@lamyergeier
Copy link
Author

Ubuntu 20.4

@mtimkovich
Copy link
Collaborator

I can't replicate this on my machine 😕 Does this only happen for files with spaces or does this happen every time?

Are you able to compile the code? If so what happens if you run renamer with this line commented?

check_input_files(&input_files)?;

@assarbad
Copy link
Contributor

assarbad commented Oct 10, 2022

Error is shown even if file exists!

$ ls
PARSIFAL - Bavarian State Opera-1.mp4  PARSIFAL - Bavarian State Opera-3.mp4
PARSIFAL - Bavarian State Opera-2.mp4  PARSIFAL - Bavarian State Opera.mp4

But these two files (!) do not exist, do they 😉?

And that is the reason why you shouldn't use ls as input for pipes in general or parse its output, especially without some basic precautions. E.g. using ls -1 (and yes, some ls flavors will turn this on when they detect a pipe) or ls -Q (no idea if this would work, given how renamer implements its logic) etc.

The appropriate (and more powerful) option is to use find -type f if you want to really pipe the input, but renamer will also happily do renamer * for this particular case (proved by the output in your own initial comment).

$ ls | renamer 
The following input files do not exist:
PARSIFAL - Bavarian State Opera-1.mp4  PARSIFAL - Bavarian State Opera-3.mp4
PARSIFAL - Bavarian State Opera-2.mp4  PARSIFAL - Bavarian State Opera.mp4

Error: Nonexisting input files. Aborting.

Yep, clearly they don't exist as your subsequent ls -la proves. At least I don't see two files named:

  • PARSIFAL - Bavarian State Opera-1.mp4 PARSIFAL - Bavarian State Opera-3.mp4
  • PARSIFAL - Bavarian State Opera-2.mp4 PARSIFAL - Bavarian State Opera.mp4
    ... instead it's four files:
  • PARSIFAL - Bavarian State Opera-1.mp4
  • PARSIFAL - Bavarian State Opera-2.mp4
  • PARSIFAL - Bavarian State Opera-3.mp4
  • PARSIFAL - Bavarian State Opera.mp4
    ... whose names end in .mp4 and starts with PARSIFAL, right?

Your shell should have done the right thing for you with renamer * and renamer would have interpreted it correctly (actually it did as the last line of output you provided proves).

What shell are you using? Perhaps provide the output of the following commands:

$SHELL --version; env|grep -E '^(LC_|LANG|EDITOR)'

@assarbad
Copy link
Contributor

assarbad commented Nov 2, 2022

@mtimkovich @marcusbuffett I strongly suggest closing this. This seems to be a case of wrong usage rather than a defect in renamer as I showed in my previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants