Is rm reversible?
I will answer even though I never used Power Shell.
Per the manual,
it says:
Delete the specified items.
Thus, at this point your question narrows down to:
Can I recover deleted file?
You can, but it is not something that you do from right click context menu.
File is not physically disappearing from the partition upon deletion. It's content remains there but being marked as free space. If this data is not overwritten by other data, then you can recover the files. There are various products which can help to do it.
One of them is free open source System Rescue CD.
Edit:
Here is an analogy of reverting rm
command in real world with real objects:
Imagine following: You dropped a bottle of milk and it cracked - milk is all over the floor.
You know how to get milk out of the floor and put it back to different bottle. (For this example let's assume the milk is not intended for drinking - it is just content of the bottle).
But now you are asking "How to cancel the drop action"? You can not cancel the drop action. Bottle was dropped and you can not "undrop" it. Milk is on the floor.
Your only solution - get milk off the floor back to different bottle before your dog will take care of it.
Related videos on Youtube
slybloty
Updated on September 18, 2022Comments
-
slybloty over 1 year
On a Windows Server 2012R2 environment, is the PowerShell cmdlet
rm
undoable? The TechNet manual for Remove-Item states that it deletes an item (multiple types), but no specification about the possibility of undeleting the item.
So, if I dorm .\filename.ext
from a PowerShell prompt, can I recover this file only using native tools?
-
Daniel R Hicks about 10 yearsOnly reversible using a mirror.
-
J Slick about 10 yearsWhy do you want to do this? If you don't want to permanently delete something, can't you just rename it or move it somewhere?
-
-
slybloty about 10 yearsNot really the answer I was looking for. I know how to recover deleted files that way. I am more interested if
rm
has a "simple" way to be reversed. -
EkriirkE about 10 years@slybloty no. 3d party tools are the only way to go
-
VL-80 about 10 years@slybloty, Well imagine following: You drop a bottle of milk and it cracked - milk is all over the floor. You know how to get milk out of the floor and put it back to different bottle. But now you are asking me "How to cancel the drop action"? You can not cancel the drop action. Bottle was dropped and you can not "undrop" it. Milk is on the floor. Your only solution - get milk off the floor back to different bottle.
-
slybloty about 10 yearsInteresting analogy.
-
Nathan Chappell over 2 yearsImagine this. You use windows explorer, then you notice that when you delete a file or folder, and then press
ctrl-z
it comes back. So you come to stack overflow to see if the same thing exists in powershell (i.e. maybe explorer uses some winapi that uses some NTFS journaling mechanism I really don't care to go read about right now, or maybe it just caches that last couple deleted files as a convenience...).