Unable To Remove Files From Directory with Error 'Argument list too long' From Command Line

(Doc ID 2400796.1)

Last updated on MAY 31, 2018

Applies to:

Linux OS - Version Oracle Linux 6.9 with Unbreakable Enterprise Kernel [4.1.12] and later
Linux x86
Linux x86-64

Symptoms

 While trying to list or interact with large number of files from command line it results with following error:

[oracle@testserver temp]$ ls -l *.xml | wc -l
bash: /bin/ls: Argument list too long
0
[oracle@testserver temp]$ rm *.xml
bash: /bin/rm: Argument list too long

[oracle@rcldap temp]$ ls -l | wc -l
325532

or when trying to delete large number of files using find command it fails with below error message:

[oracle@testserver temp]$ find /u01/oracle/apps/fs1/EBSapps/appl/xdo/12.0.0/temp/*.xml -mtime +120 -exec rm -v {} \;
bash: /usr/bin/find: Argument list too long

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms