$ ls -1 | grep -v '. Pdf$' | xargs -I {} rm -i {} Or, if you are confident: $ ls -1 | grep -v '. Pdf$' | xargs -I {} rm {} Or, the bulletproof version: $ find .
-maxdepth 1 -type f! -iname '*. Pdf' -delete.
That Worked! Thanks for the magic – xiamx Jan 15 at 22:54 2 ls output is meant to be displayed to the user, not parsed. Ls may substitute character or reformat the filenames in order to present it to the user.
– Juliano Jan 15 at 22:55 {} or "{}" makes no difference to the shell, it is a single parameter passed to the command – Juliano Jan 15 at 22:59 @Juliano: Thx, edited my post. – miku Jan 15 at 23:03 It is still wrong because ls is not meant to produce a list of files to be parsed by other tools. Ls is meant to produce a user-readable list of files, and by making it user-readable, ls may substitute characters in the file names, which may cause wrong results.
Touch $'A file\nwith a newline' will create a file that will break your command. – Juliano Jan 15 at 23:06.
This will include all subdirectories: find . -type f! -iname '*.
Pdf' -delete This will act only in the current directory: find . -maxdepth 1 -type f! -iname '*.
Pdf' -delete.
1 this will also delete the non pdf files in subdirectories – Robokop Jan 15 at 22:56 @Robokop: fixed. – Juliano Jan 15 at 23:07.
This should do the trick: shopt -s extglob rm!(*. Pdf).
Ls | grep -v '. Pdf$' | xargs rm This will filter all files that don't end in PDF, and execute RM on them.
1 This one has problems with spaces... – Fritschy Jan 15 at 22:55 Hmm, apparently it does. I never noticed before, thanks for pointing that out! – TyrantWave Jan 15 at 22:57.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.