The question is ripe, there is a structure for example:
/ uploads / images /
/ uploads / images / crop /
/ uploads / images / thumb /

How to delete all files without affecting the "crop / thumb" folder?) Manual removal is already practicing, and I don’t really like it)

  • after all it is not clear whether it is necessary to delete files in other subfolders if they are there? - ArcherGodson

1 answer 1

find /uploads/ -type f | xargs rm 
  • Sorry, but this is fundamentally wrong! This way ALL files in the uploads tree will be deleted. IMHO, is correct so: find / uploads / -type f-path / uploads / images / thumb / -prune | xargs rm It is possible and even shorter: find / uploads / -type f -path / uploads / images / thumb / -prune -deleteBut there may be inconsistencies due to -depth. - areshin
  • "This way ALL files in the uploads tree will be deleted" in general, the task is set. Before you go, you should at least check it out. - pyatak
  • I didn’t check it because there was no access to the Unix system, but the principle was clear what can be done via find =) - Quiss 1