I am using a ZFS system that has reached its disk quota. As a result, the rm
command no longer is available to me. However, I am able to copy /dev/null
to particular files to effectively remove them.
The issue is that the directory I am trying to clear out is roughly 40GB in size, and each file that has any girth is buried within 3 levels.
Is there a command line way to easily search and replace those files with /dev/null
? I could do it pretty easily in Python/Perl, however I want to try via the command line.
Edit: this is the better answer found in the comments:
find $DELDIR -type f -exec cp /dev/null "{}" \;
The old answer is here:
find $DELDIR -type f | xargs cp /dev/null
where
$DELDIR
is the name of the directory to start in. The-type f
option targets only files, not directories. And of coursexargs
just finishes offcp /dev/null
with the file names from each line of find output.