user2531569
user2531569

Reputation: 619

how to download today's files based on filename using sftp in unix

In my "Remote_InputFolder" directory i had the below list of files.

physicalDevice_20130722000000_incremental.xml
userProfile_20130722000000_full.xml
physicalDevice_20130723000000_incremental.xml
userProfile_20130723000000_full.xml
physicalDevice_20130724000000_incremental.xml
userProfile_20130724000000_full.xml

i want to download files having today's date in their filename. i used the below sftp code, but it's not working.

sftp ${SFTPUserName}@${SFTPHostName} <<EOF .... get *{date +%Y%m%d}*.xml ..EOF

Any help please.

Upvotes: 1

Views: 4119

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24617

It should be:

$(date +%Y%m%d)

instead of:

{date +%Y%m%d}

Upvotes: 1

Related Questions