V
V
VKinco2020-07-13 17:37:57
Automation
VKinco, 2020-07-13 17:37:57

Moving all files except .pdf to another folder, how to do?

I ask for help.
There is a program for text recognition. The profile is set up in such a way that it takes all the contents of an incoming email, copies it to a temporary folder, then takes all the files from it and sends it for recognition. For recognition, it takes only .pdf and .tiff files, ignores the rest, then cleans the temporary folder.
You need to add a script to the profile that would take all other files from the temporary folder and simply move them to the desired one. According to the manual for the program:

Scripting can be done in C# either by writing scripting code in the Scripting Editor.

Looks like this:
5f0c71433b9d0958687091.jpeg
Can anyone plz suggest how to do it :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Janus74, 2020-07-17
@VKinco

something like this

string pathSource = "D:\\test\\files";
string pathCopyTo = "D:\\test\\copyTo";
Regex regex =new Regex(@".*pdf$");
foreach (var item in Directory.GetFiles(pathSource))
{
    if (!regex.IsMatch(item)) {
        File.Move(item,item.Replace(pathSource, pathCopyTo));
    }
}

K
Karpion, 2020-07-13
@Karpion

  1. Make a complete list of files.
  2. Exclude from this list*.pdf
  3. Move the rest where needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question