A Web.com Partner

Move a large number of files in Linux

Files in Linux

 

This tutorial will show you how to move a large number of files in Linux

/bin/mv: Argument list too long

When you are trying to move large number of files such 200000 files. you can use the command

mv  /path/to/old-directory /path/to/new-directory

If you try the above command, you will be getting the error “/bin/mv: Argument list too long”

You can use the command given below to avoid this error ,

find /path/to/old-directory -type f | xargs -i mv "{}" /path/to/new-directory
x