I want to delete 1 file at a time from my directory which contains so many files, so I want to remove 1 file at a time. Just to avoid too many reads and failed at too many arguments.
find ./Backup/ -name '*.csv' -maxdepth 1 -exec rm {} \;
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
find: cannot fork: Cannot allocate memory
I don't want to delete recursively from a child directory thats why -maxdepth 1. Any help and suggestion?
-deleteinstead of-exec rm {} \;should solve it. Other than that, just move-maxdepht 1before-name. Don't forget to test without-deletefirst.-exec ... '{}' \+form offindmight save on forks, as this emulatesxargsin (modern) versions offind.