OS/X (bash) - Command to remove non essential files not working
See original GitHub issueI am using mac with Sierra and the command to remove non essential files not working, here is the output for same -
Jeetendras-MacBook-Pro:quickstart Jeet$ xargs -a non-essential-files.txt rm -rf
xargs: illegal option -- a
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
[-L number] [-n number [-x]] [-P maxprocs] [-s size]
[utility [argument ...]]
Though there are workarounds for it, it would be good to have a fix here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
5 Solutions to Force Delete a File on Mac[2022]
Step 3 - Find the File That You Want To Delete. Drag that file to the Terminal window that you want to delete....
Read more >How to delete files and folders using command line on Mac
Here's how it works in practice: Launch Terminal from your Utilities folder in Applications. Check which directory you're in by typing ls -la....
Read more >How to delete files and folders using Terminal
Take the commands in this article as an example: the rm command allows you to remove (or delete) files. The rmdir command does...
Read more >Angular 2 - Remove non essential files from QuickStart seed
The first command doesn't work. Looks like xargs on Mac doesn't have -a option. What is the equivalent to the first command on...
Read more >macos - Kill all non-essential processes - Ask Different
The processes you mention would all be killed by one command: kill -9 -1. That would also log you out and kill all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leebenson I think
1.
makes the most sense. Sounds like you’d have to fix the file regardless and it’s probably better to use a command that’s valid on more *nix flavors(including OS X).Thanks for the quick response!
There are some extra nonreadable characters, at least by RHEL7, within the file.
rm -rf $(cat non-essential-files.txt)
doesn’t work either.A
hexdump
of the file shows what’s wrong:The solution should be as simple as copying the file to your clipboard and then pasting it over the existing file. That worked for me.
Here’s also a list without the offending characters you can paste into a file that will work with
xargs -a <file> rm -rf
For those uncertain if it’s working try
xargs -a <file> ls
and it’ll show you what will be touched by the command.