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*

Take a count of file in the folder:
ls techlogs/ | wc -l

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”

 

Author: Danyal
I'm a skilled programmer specializing in Vue.js/Nuxt.js for front-end development and PHP Laravel for back-end solutions. I have a strong focus on API design and development, complemented by experience in web server setup and maintenance. My versatile expertise ensures seamless creation and maintenance of web applications, covering everything from intuitive user interfaces to robust server-side functionality. Passionate about coding and driven by a lifelong learning mindset, I invite you to explore more at danyal.dk.