Hey guys,
I am looking for simple shell script, so i can remove every second file in a directory.
For example in any given directory there are 10.000 files:
0001.jpg
0002.jpg
0003.jpg
0004.jpg
0005.jpg
0006.jpg
0007.jpg
0008.jpg
....
1111.jpg
1112.jpg
etc.
After running the command, it will delete every second file in the directory. Instead of 10.000 files there are now 5000 and the dir will look like:
0001.jpg
0003.jpg
0005.jpg
0007.jpg
....
1111.jpg
Now in this example I am deleting the second line, which result in only the even numbers getting deleted. But I want to be able to shrink down the directory every time I run the command.
So after running it a second time it should half the size of the directory in number of file and look like this:
0001.jpg
0005.jpg
....
etc
I already renamed all the files so that they are sequential.
Thanks!