How to delete all your files
21–30 of 66 posts
Re: How to delete all your files
#22Maybe we need transactional file systems. At work, on our databases, when I'm running an ad-hoc update or delete on something that's not trivial to recover then in my DB tool I will often have something like:
BEGIN TRANSACTION
UPDATE ...
SELECT ...
-- COMMIT TRANSACTION
If the select validates that the update was good (and the update doesn't say "1000000 rows updated"), I'll just highlight COMMIT TRANSACTION and hit run. This isn't a perfect solution since I either need to hold the transaction open or run the update twice (first time immediately followed by a rollback), but a blip in accessibility is better than having to restore the latest nightly backup and run any processes that updated the table since it was taken.Re: How to delete all your files
#23I mixed up dd's "of" and "if" args once when trying to image a disk. And of course, it failed somewhere in the middle after borking something important.
From https://liw.fi/linux-anecdotes/
But if and of are "easy", since they stand for "input file" and "output file"?
Re: How to delete all your files
#24You almost never need to use "*". Use ".", or go up a dir and type the name of the dir.
Re: How to delete all your files
#25I mixed up dd's "of" and "if" args once when trying to image a disk. And of course, it failed somewhere in the middle after borking something important.
> At one point, Linus had implemented device files in /dev, and wanted to dial up the university computer and debug his terminal emulation code again. So he starts his terminal emulator program and tells it to use /dev/hda. That should have been /dev/ttyS1. Oops. Now his master boot record started with "ATDT" and the university modem pool phone number. I think he implemented permission checking the following day. Fro…
Yes, but which hard drive device is which isn't as straightforward. My fault, of course...just got them mixed up.
Re: How to delete all your files
#26I mixed up dd's "of" and "if" args once when trying to image a disk. And of course, it failed somewhere in the middle after borking something important.
Re: How to delete all your files
#27It's a shame that 'glob is a generator' did not become the standard way of doing things. It would save so much headache (and make writing programs easier) if command * (or similar syntax) expanded to something like command /some/fd where calls to read(/some/fd) produced "expansion_one␀expansion_two␀expansion_three␀...␀" Though exactly how one would plumb this is its own question.
Re: How to delete all your files
#28I once saw a friend nearly delete all their files using tip#3 from the thread: > never use only * as a wildcard. A ./* would save you in most cases My friend typod that for /* in an rm -rf command but caught it just in time. They seemed like unnecessary characters to me if it does the same as *, and I don't think they do it anymore, but now I'm not sure which is worse... I suppose good backups just go a long way what…
I just did that last weekend! After an allnighter, which isn't easy for me anymore, I typed: ``rm -rf. /*`` with the dot and the space reversed. When the shell threw an error in my face, I thought, "oh, an extra dot." so I deleted the dot and re-run the command. And there goes my configs and most of the dotfiles in my home dir. Luckily, I have backup for some of those, so it wasn't a complete disaster. I don't trust…
Re: How to delete all your files
#29“Because the share contains a file named exactly "--delete", and since it gets sorted first, rsync thinks it to be an argument and deletes everything.” Also because Unix made the mistake (edit: calling this a mistake may be unfair) of having the shell expand wildcards. If it had provided a library for doing that, the “rsync thinks it to be an argument” part wouldn’t happen. Alternatively, a file system could sort hyp…
The problem is of course that wildcard handling ends up being inconsistent between tools or entirely missing, although in practice this became less common as various Win32 calls related to file operations had internal wildcard handling, so applications got a basic form "for free".
As with many things in computing it's hard to say that either approach is superior to the other. PowerShell carries on the DOS tradition of not expanding wildcards in the shell, but provides a more complete and standardized wildcard implementation as part of the API to improve consistency.
Re: How to delete all your files
#30rsync -r ./ ~/Documents/ Why would I even need to use *, if I wanted all files from a directory?