Move specific files

How can I move several files from one folder to another but only the pure .pdf and. xlsx

any example shared with me

@Ivan_torres_oliva
You can use below code:

For each item in Directory.GetFiles(“C:\SourceFolder”,"*.xlsx")

  • Move File : Source = item.ToString Destination = "C:\DesFolder\ " + Path.GetFileName(item.ToString)

For each item in Directory.GetFiles(“C:\SourceFolder”,"*.pdf")

  • Move File : Source = item.ToString Destination = "C:\DesFolder\ " + Path.GetFileName(item.ToString)

(Please remove the space at the end of C:\DesFolder\ when you copy this code)

thanks bro

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.