sh - How could I remove one older folder with bash? -
i have following folders:
1435773881 jul 1 21:04 1435774663 jul 2 21:17 1435774856 jul 3 21:20 1435775432 jul 4 21:56 i need remove older folder folder (1435773881 in case above) bash script.
what command should use?
you can do
ls -lt | tail -1 | awk '{print $nf}' | xargs rm -rf ls -lt | tail -1shows last line after sorting directories dateawk '{print $nf}'"prints" last column (which directory name)xargs rm -rfdeletes directory
Comments
Post a Comment