0

After running the following code in a directory (actually a sub-directory of my pictures folder, if that helps) consisting of nothing other than about 60 png images:

for i in *;
do  mv "${i}" Surv${53+count}.`echo "${i}" | awk -F. '{print $2}'`;
((++count)); done

I found that all but the last of these pngs images had vanished. Is there any way to restore them? At the time I thought that I had them backed up, but I am sad to discover that I have in fact not.

dessert
  • 39,392
  • 12
  • 115
  • 163
J. Mini
  • 138
  • 1
  • 16
  • I can nothing but recommend `alias mv='mv -i'` for the `~/.bash_aliases`. – dessert Apr 30 '18 at 14:21
  • And what is that, exactly? – J. Mini Apr 30 '18 at 14:24
  • That enables the `-i` option for every time you rename something with `mv` something, so that it asks you for every single file it overwrites. As to your current problem please try the solutions presented in the following question: – dessert Apr 30 '18 at 15:57
  • Is this question not more specific than that issue? At the very least, I'd hope that this specific method of deletion would allow for an easier solution. – J. Mini Apr 30 '18 at 16:37
  • You mean more like [Can files/directories deleted with rm be restored?](https://askubuntu.com/q/6698/507051)? I fear there's not much of a difference whether you “deleted” a file with `rm` or “overwrote” it with `mv`, in either case *the link* to the file is destroyed. Recovery tools in general try their best to get these links back, and that's also what you want to do now – as far as I know. – dessert Apr 30 '18 at 17:13

0 Answers0