This is a discussion on how to recover deleted files using script within the Shell scripting forums, part of the Development/Scripting category; Hi, I need a script to undelete the removed files....
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
| Sponsored Links | ||
|
|
|
|||
|
Have a look at http://e2undel.sourceforge.net/recovery-howto.html
http://www.stud.tu-ilmenau.de/~mojo/undelete.html Writing script is not difficult but first see those pages! |
|
||||
|
You can use grep command, for example if you want to undelete a text file with 100 lines starting with "top secret " which was stored on /dev/hdc2 you can try:
Code:
grep -a -B2 -A100 "top secret" /dev/hdc2 > /tmp/recovered.txt -a : Process a binary file as if it were text -B N: Print N lines of leading context before matching lines -A N: Print N lines aka recover 100 lines of trailing context after matching lines You can use above grep command in script make sure you run it as root user, /dev/hdc2 unmounted, and /tmp is not mounted on /dev/hdc2 You can also try one of the above tools http://e2undel.sourceforge.net/recovery-howto.html Also if you are using a journalled filesystem like ext3 it is difficult to do undelete please have look at below: Quoting the Ext3 FAQ, http://batleth.sapienti-sat.org/proj...ext3-faq.html: Code:
"Q: How can I recover (undelete) deleted files from my ext3 partition? A: Actually, you can't! This is what one of the developers, Andreas Dilger, said about it: In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas ext2 just marks these blocks as unused in the block bitmaps and marks he inode as 'deleted' and leaves the block pointers alone. Your only hope is to 'grep' for parts of your files that have been deleted and hope for the best." |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| i need a script to delete one folder with files on my ftp | silver_ch | Shell scripting | 1 | 03-27-2007 11:15 AM |
| Script to extract some part of files: | satish1482 | Shell scripting | 0 | 03-13-2007 06:30 PM |
| Shell script for automatic conversion of files in tar files | kasimani | Shell scripting | 2 | 02-08-2007 04:45 PM |
| script for uploading files to a FTP server | marinm | Shell scripting | 7 | 01-02-2006 08:35 PM |
| Script to remove executable files | sweta | Shell scripting | 4 | 03-12-2005 02:21 PM |