-1

https://unix.stackexchange.com/a/624808/ says:

A simple way:

  1. cd into the directory of the files
  2. Run ffmpeg -f concat -safe 0 -i <(for f in ./*.mp3; do echo "file '$PWD/$f'"; done) -c copy ./output.mp3

This only works if you cd into the actual directory and not to a shortcut to it.

More at the ffmpeg wiki page on Concatenate

Why is "This only works if you cd into the actual directory and not to a shortcut to it"?

It works for me when I cd into a folder of the files via a softlink to an ancestral folder.

Tim
  • 98,580
  • 191
  • 570
  • 977
  • 2
    You have more than 50 rep, you can comment on the answer to ask for clarification – muru Aug 08 '23 at 06:30

2 Answers2

3

I think that the answer is a mix of UNIX/Linux and Windows solutions.

The statement about the code not working if you're using a shortcut to the directory is valid for a Windows environment.

It does not appear to be a valid or necessary restriction when running under UNIX/Linux. It also appears to be an unnecessary restriction for Cygwin too, as Cygwin doesn't work with Windows file or directory shortcuts.

roaima
  • 107,089
  • 14
  • 139
  • 261
1

I believe the problem occurs in some cases when windows (I assume) sees the NTFS Links (junction) instead of the destination one, and tries to create the ./output.mp3 files in it (which could fail depending on its location and rights).

You could simply try to do a : cd -P the_directory, instead of simply cd the_directory, to have the shell "resolve" and find the "canonical" path, ie the real one, not the symlink one.

(This could be a bit trickier if you have lots of symlinks or maybe ntfs equivalents ...)

Olivier Dulac
  • 5,924
  • 1
  • 23
  • 35
  • NTFS symbolic links exist. They are totally different to Windows "shortcuts" – roaima Aug 08 '23 at 09:57
  • I was referring to NTFS symbolic links, but couldn't remember the proper term ("shortcut directory" was what I chose to replace it with, as it implies it acts like a directory and isn't just a windows shortcut). I will replace with the proper term, thank you! – Olivier Dulac Aug 10 '23 at 06:55