1

I'm using the command ls *Pattern*Date* Files.txt to get a list of files from FTP to my local text file.

I'm now required to get multiple patterned files (The Date and Pattern may come in different order). So when I try to add another line ls *Date*Pattern* Files.txt, this clears the FCCfiles.txt and I'm not able to get the first set of files.

Is there any command that can append the list of files rather than creating new files list?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Arun
  • 65
  • 1
  • 9

1 Answers1

1

You cannot append the listing to a file with ftp.

But you can merge multiple listings in PowerShell. I assume that you run ftp from PowerShell, based on your use of tag.

In ftp script do:

ls *Pattern*Date* files1.txt
ls *Date*Pattern* files2.txt

And then in PowerShell do:

Get-Content files1.txt,files2.txt | Set-Content files.txt

(based on How do I concatenate two text files in PowerShell?)

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992