1. A method comprising: identifying a directory to be migrated from a source file system to a target file system; comparing a size of the directory in a source file system to a size threshold; generating a comparison value by dividing the size of the directory by the size threshold; determining, based on comparing the size of the directory in the source file system to the size threshold, that multiple threads are to be used to migrate the directory from the source file system to the target file system; determining that a first portion of the directory is to be migrated using a serialized technique; determining that a second portion of the directory is to be migrated using a parallelized technique; calculating a degree of parallelism available, the degree of parallelism available being based on the first portion of the directory and the second portion of the directory; calculating a first number of threads for migrating the directory, the first number of threads determined based on the degree of parallelism available for the migration and a performance gain slope; calculating a second number of threads to migrate the directory from the source file system to the target file system, the second number of threads determined by comparing the first number of threads to the comparison value; allocating the second number of threads; and migrating the directory from the source file system to the target file system using the second number of threads.