4

OSX argument list too long; Sigh

 3 years ago
source link: https://fuzzyblog.io/blog/bash/2019/10/02/osx-argument-list-too-long-sigh.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

OSX argument list too long; Sigh

Oct 2, 2019

The longer you do computing, the more you find that the same out issues come up. I'm currently working on a machine with 16 gigs of RAM and a terabyte of SSD storage but when I list files in a directory, I still get "argument list too long". The problem here is that I have a series of directories that collectively have 552 gigs of data in them (a crawler I wrote either worked successfully or ran amok; your opinion may vary).

I woke up this morning and realized that I couldn't move over to my machine the zst archive I needed since it was 15 gigs in size and I had only 24 gigs total (too close to my threshold for my taste).

I ended up coming up with this command line snippet to address this:

find . -maxdepth 1 -name '*.html' -delete

I had to change into each directory where these files existed and run it one by one.

If I wanted to make this recursive then I could have started in the parent directory tree with this:

find . -name '*.html' -exec rm -f {} \;

but that felt riskier… Here's a relevant Stack Overflow on this.


Posted In: #osx #bash


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK