1

I'm trying to copy files from a remote machine to my local machine:

resource.txt

/path/dir/file1.txt
/path/dir/file2.txt
/path/dir/file3.txt

cat resource.txt | xargs -I F scp <user@ip>:F /localpath/dir/

I'm getting something like this : No such file or directoryir/file1.txt

What could be the reason?

1 Answer 1

3

Your line terminators in your resource.txt file are probably wrong. Please, run the following command:

strings resource.txt >new_resource.txt

and use the new_resource.txt file created.

2
  • Yes, It worked. Thanks. cat -v showed ^M in resource.txt
    – Naive
    May 26, 2019 at 15:55
  • 1
    Use cat -e new_resource.txt; you will see $ at the end of lines (which indicate the correct line terminator for Linux). Use cat -e resource.txt; you will probably see ^M in place of line terminators and everything will be displayed in a single line (this will indicate that Carriage Returns have been used instead of the correct Line Feeds).
    – FedKad
    May 26, 2019 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .