Re: Help! How to delete an 8094-byte PATH?

Matthew Wilcox
2022-01-27T13:40:48Z

On Thu, Jan 27, 2022 at 05:50:39PM +0530, Ritesh Harjani wrote:
> On 22/01/27 07:06AM, Maxim Blinov wrote:
> > $ for i in $(seq 999999); do echo "im $i levels deep"; cd confdir3; done;
> >
> > It then ran for a while, and eventually I got to the bottom:
> >
> > ```
> > ...
> > im 892 levels deep
> > im 893 levels deep
> > im 894 levels deep
> > im 895 levels deep
> > im 896 levels deep
> > bash: cd: confdir3: File name too long
> > $ ls
> > <nothing here>
> > ```
> >
> > So then, I `cd ../`, and `rmdir confdir3`, but even here, I get
> >
> > rmdir: failed to remove 'confdir3/': File name too long
> >
> > I would be very grateful if someone could please help suggest how I
> > might get this infernal tower of directories off of my precious ext4
> > partition.
> >
> > I was thinking maybe there's some kind of magic "forget this directory
> > inode ever existed" command, but I am out of my depth with filesystems.

here's an idea:

while true; do
mv confdir3/confdir3 tmpd; rmdir confdir3; mv tmpd confdir3;
done