Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have recently taken to using the command line more in order to gain more experience and increase my knowledge of the Linux systems.
I have a (pretty major maritally) problem. I moved the folders containing our pictures using the mv command:
Quote:
mv /{original_position} /{new_position}
This appeared to work until I noticed that the folders only have been moved and there is no sign of the files in either the original source or destination.
Where have they gone and can I get them back?
Next time I'm copying them and deleting the source when I make sure they are safe!!!!
Well you learn from mistakes but I really would like these back, if only to avoid deafness and a 20 year headache.
Wow that is odd, maybe try testdisk/photorec to recover the images. I have used it to recover images that were deleted, it worked well. http://www.cgsecurity.org/wiki/PhotoRec to install in fedora
This aspect of a Linux (or any) filesystem should be pretty much deterministic.
Within one physical drive, a mv command will not actually relocate anything---it only changes the info used to get to the folder/files. As others have pointed out, the files will be recoverable. (Just don't write to the disk.)
I am curious about your description of the move: "mv /source /destination". You would not normally be moving files or folders at the root level like that. Can you post exactly where the folder was and exactly what command you used?
I suggest also using the -v option to provide verbose output, both for mv and cp. Set it up as an alias for it so that it becomes the default behavior. It would've probably told you instantly what happened.
You might also consider the -i option, which makes it ask you interactively before actually performing the move, although that can become tedious when you're operating on a large number of files at once. One compromise is to use -i for the first few files, then crtl+c terminate the command and re-run it for the rest of them without the interaction.
Well folks, thanks to everybody for the help and advice. I searched using parts of the file names, extensions but got nothing. However I did try photorec after a suggestion from highfructose327 and that has recovered my files. I will definitely copy my files from now on rather than moving them. Again thanks to everybody for their advice.
I am curious about your description of the move: "mv /source /destination". You would not normally be moving files or folders at the root level like that. Can you post exactly where the folder was and exactly what command you used?
I used the command as follows:
mv /home/kevie/pics /temp/
I was keeping the stuff I was wanting before cleaning out my home folder, I had previously made a folder called temp with the mkdir command. Like I said I am trying to use the command line more and have been consulting the Command Line and Shell Scripting Bible.
There's no need to be afraid to use mv or to be overly-cautious with it. But you do have to watch what you're doing. I think the problem you had is mostly because the default action for many *nix tools is to work silently, without feedback. You just need to set things up to provide you with some interaction, gain some experience, and you'll be fine.
There's a package I recommend called removeutils. Two of the programs it contains are imv and icp, which work just like the standard mv and cp, but if you give them only a single file or directory argument it will place it in an edit buffer and let you simply rename it directly. I've found it very convenient and safer than the originals when renaming files and moving directory trees. You can set up aliases so that they can perform as substitutes for the core versions.
I still suggest using the interactive options, of course.
Just to check, whas it really "/temp/" or was it "/tmp/". If the latter did you reboot your machine? On many systems all files in /tmp/ will be deleted on a reboot.
I did make sure that I made the folder called "temp", I may not be that experienced but I am aware that if I moved files I needed to "tmp" that I would not see them in a hurry, that's why I used the "temp" folder as it was not native and does stick out a bit at root level.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.