How to move to exception folder if pdf file pages >2

i have directory of pdf files. in that pdf pages contain number of pages Don’t know.
i want to move pdf files if pdf page contain >2 pages i have to move exception folder.
how can write it ?

Hi @Anand_Designer

You can try this way

Use assign activity to get the path of PDF file paths on directory.

file_list= Directory.GetFiles(folderpath)

now use for each loop activity to loop through each element in file_list ( for each item in file_list)

Inside the for each loop do the following

Use the Get PDF Page Count activity to get the count of pages in PDF files

Check the below link for activity description

In that activitiy configure the following properties.

Filepath : specify the filepath for which u need to get the page count (in this case it is each item through which we are looping)

Page Count : specify a varaible here which store the page number of each PDF file, let’s say count

Now use an if condition with condition as


if the condition is true, then in Then section use move file activity to move the file to exception folder

Hope it helps you


Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed::relaxed:

Hi Anand,

You can use the if condition to achieve that - and as for moving the required file into exception folder:

Lets assume the file path for the Exception Folder is stored in variable ExFilePath.
Lets assume the file path for the Folder containing files being iterated is PdfsFilePath.
You will use the “For Each” activity and provide the argument as:

You will then include the Get Page inside the For Each activity, after which you will add the If Condition to check if the number of pages are less than 2

The activity called “Move File” can be used to achieve the transfer, and the loop will perform its function until all documents have been processed.

Hope you find this resourceful!

Thanks For both give Solution to me @NIVED_NAMBIAR @ashwin.ashok


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