Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the copy-the-code domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pb-seo-friendly-images domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the johannes domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/pcx3.com/wp-includes/functions.php on line 6121
Find and truncate all files in the oldest subdirectory - PC✗3
Find and truncate all files in the oldest subdirectory

Find and truncate all files in the oldest subdirectory

image 12 - Find and truncate all files in the oldest subdirectory

This command will search for directories in the current directory and its subdirectories, find the oldest subdirectory in each directory, and display them on to screen:

find . -maxdepth 1 -type d -exec sh -c 'oldest_folder=$(ls -ltr "$1" | awk "/^d/ {print $NF; exit}"); echo "$1/$oldest_folder"' sh {} \;
image 13 - Find and truncate all files in the oldest subdirectory

To truncate all files in those oldest subdirectories (snap.X on the screenshot above) use:

find . -mindepth 1 -type d -exec sh -c 'oldest_folder=$(ls -ltr "$1" | awk "/^d/ {print $NF; exit}"); > "$1/$oldest_folder"/*' sh {} \;

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.