Solved: ‘/bin/rm: Argument list too long’ error

I faced this issue while I was removing huge list of files from a folder using
sudo rm -rf /folder/some-filename-2017*

Upon googling found following command, that fixed my issue.

cd /folder
sudo find . -name 'some-filename-2017*'
Above command will list all files start with “some-filename-2017”

sudo find . -name 'some-filename-2017*'| xargs rmĀ 
Above command will delete all files start with “some-filename-2017”

 

About the author

Danyal Ali Butt

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts