I want to archive files (with tar) which are below 3 MB in size. But I also want to retain the directories in which those files exist. (so I cannot use
find command). I just want to avoid the files which are above 3 MB in size. How can this be done?
Simpler than you think:
On a semi-related note (relating to your statement that you can't use find) to get a listing of all files (including directories) under a path minus files larger than 3MiB, use:
You could then do:
But I'd prefer the first one as it's simpler, clearly expresses what you want and will lead to less surprises.
If the filename contains square brackets, in some systems, need to exclude explicitly. For example