After some lovely feedback from Sotiris Tsimbonis on my last post Find and delete old files in linux I have a better (faster) way to delete files.

Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.

The old way …

`After some lovely feedback from Sotiris Tsimbonis on my last post Find and delete old files in linux I have a better (faster) way to delete files.

Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.

The old way …

`

The better faster way

``After some lovely feedback from Sotiris Tsimbonis on my last post Find and delete old files in linux I have a better (faster) way to delete files.

Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.

The old way …

`After some lovely feedback from Sotiris Tsimbonis on my last post Find and delete old files in linux I have a better (faster) way to delete files.

Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.

The old way …

`

The better faster way

``

And lets see the creation loop with xargs since we are talking about squeezing a tad more performance out of things.

The standard for loop …

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
``After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
`` 
  
And lets see the creation loop with xargs since we are talking about squeezing a tad more performance out of things.
  
The standard for loop &#8230;
  

And the better faster xargs way

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
``After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
`` 
  
And lets see the creation loop with xargs since we are talking about squeezing a tad more performance out of things.
  
The standard for loop &#8230;
  
```After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
``After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
`After some lovely [feedback][1] from [Sotiris Tsimbonis][2] on my last post [Find and delete old files in linux][3] I have a better (faster) way to delete files.<!--more-->

<!--adsense-->


  
Spawning processes is expensive, its much better to not spawn a new process if its not needed. Just for proof I created 100 empty files in a temp directory and deleted them both ways.
  
The old way &#8230;
  
` 
  
The better faster way
  
`` 
  
And lets see the creation loop with xargs since we are talking about squeezing a tad more performance out of things.
  
The standard for loop &#8230;
  
``` 
  
And the better faster xargs way