1

I'm using a single line in cygwin to move files from a list to another folder.

$ for file in $(cat list.txt); do mv "$file" destination; done

Half the files are fine and go where they belong but the rest provide the error "mv: cannot stat 'filename.pdf'$'\r': No such file or directory". How do I get around this error so the remaining files will move?

Dan
  • 11,370
  • 4
  • 43
  • 68
  • It looks like your list.txt file contains DOS-newlines (\r\n) which confuses Cygwin. You can convert the file to Unix-style newlines (\n) with the dos2unix command. See https://stackoverflow.com/questions/43693127/cygwin-r-command-not-found-error?rq=1 – EJK May 30 '19 at 15:47
  • I saw that question but didn't understand the answer until just now. Thank you. – Christian Virtue May 30 '19 at 15:59
  • Cant even rename some files. Trillion dollar OS – wilmol Dec 03 '21 at 03:01

0 Answers0