You can head -n and get a list to send to.
if you want to purge the directory, but you can't remove it and recreate it, I suggest moving it and recreating it instantly. mv folder folder_del mkdir folder rm -rf folder_del this is faster, believe it or not, as only one inode has to be changed.
Apr 14, In this case, a “file” can be anything: a regular file, a directory, a pipe, etc. you can add the -type f option if you want to remove regular files only: find. -mindepth 2 -maxdepth 2 -name 'out' -type f -delete With -name 'out' you get all files which name contains out. And -delete tells find to delete. fast Linux directory tree removalHelpful? Please support me on Patreon: bushlopping.bar thanks & praise to God, and with thanks to.
Feb 26, To remove all empty directories in a directory tree you would run: find /dir -type d -empty -delete. Here is an explanation for the options used: /dir - recursively search in the /dir directory.-type d - restricts the search to directories.-empty - restricts the search only to empty directories.-delete - deletes all found empty directories in the subtree. Jul 05, The -r (recursive) switch removes everything below a directory, too -- including subdirectories.
(Your command does not remove the directories, only the files.) You can also speed up the find approach: find -type f -print0 xargs -0 rm.