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 course xargs
just finishes off cp /dev/null
with the file names from each line of find output.
仔细尝试:
find $DELDIR -type f | xargs cp -af /dev/null {} \;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.