I have a folder containing 2Gb of images, with sub-folders several levels deep.
I'd like to archive only
N files of each (sub) folder in a tar file. I tried to use
tar but couldn't manage to get it to work. Here is what I tried (assuming
N = 10):
find . | tail -n 10 | tar -czvf backup.tar.gz
… which outputs this error:
Cannot stat: File name too long
What's wrong here? thinking of it - even if it works I think it will tar only the first 10 files of all folders, not the 10 files of each folder.
How can I get
N files of each folder? (No file order needed )