LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 10-07-2016, 04:20 PM   #1
georider
LQ Newbie
 
Registered: Mar 2006
Distribution: Suse OSS 10.1, Debian 3.1, Solaris 8, Ubuntu Gutsy
Posts: 10

Rep: Reputation: 0
Recover from moving files into a file instead of folder


So, honestly over the several years I've been administering and working with *nix, I have never done this. How, I'm not sure.

So, I was running a simple 'find . -iname '*.avi' -exec mv '{}' ../videos_avi \;' only the '../videos_avi' folder didn't exist.

Now, all the avi files are nestled snuggly in a file called videos_avi. I recall reading about how to split this up again, but for the life of me and all my googling powers I cannot locate the answer today.

Your insight would greatly be appreciated!

-g
 
Old 10-07-2016, 05:53 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,566

Rep: Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093Reputation: 2093
Sorry, but those files are not "nestled snuggly" in the videos_avi file. That file contains the last file that you moved there, and nothing else. Your problem now is the basic one of recovering deleted files. That's probably one you have run into before, and step one is to stop using the system. Every change in that filesystem decreases your chances for recovery.

For the future, know that you can protect against this sort of error by including the trailing "/" in the folder name. A trailing slash means, "an existing folder with this name," and will result in an error if that folder does not exist.

Last edited by rknichols; 10-07-2016 at 05:57 PM.
 
1 members found this post helpful.
Old 10-07-2016, 05:56 PM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,960

Rep: Reputation: 798Reputation: 798Reputation: 798Reputation: 798Reputation: 798Reputation: 798Reputation: 798
as there was no folder to move the files to the mv command would have overwritten the videos_avi file repeatedly so your files are gone execept for the last one that will have been renamed to vdeos_avi

rk you type faster than me!

Last edited by Keith Hedger; 10-07-2016 at 05:58 PM.
 
Old 10-07-2016, 07:24 PM   #4
georider
LQ Newbie
 
Registered: Mar 2006
Distribution: Suse OSS 10.1, Debian 3.1, Solaris 8, Ubuntu Gutsy
Posts: 10

Original Poster
Rep: Reputation: 0
rk/Keith,

Thanks for your replies. This is actually a recovery operation already as these were recovered from a failing 2TB drive. So, I've got the originals. Just didn't want to wait another 2 weeks while running photorec again due to me being lazy. Yeah, I need to get back into the habit of using the trailing slash. And, I verified your thoughts that it simply kept overwriting the file. Now that I think about it, it makes perfect sense.

Have a good one.

-g
 
  


Reply

Tags
bash, find


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
moving files to root folder o-madsen Linux - Newbie 13 05-12-2013 02:59 AM
Moving 2 months of old files from a folder to another folder. Iyyappan Linux - Server 6 07-13-2012 04:45 AM
[SOLVED] Moving files from folders and subfolders to a specific folder mrj2 Linux - Newbie 12 08-22-2010 12:40 PM
my folder turned into a single file!! how to recover? RohitBhosale Linux - General 1 07-06-2009 03:14 PM
Moving certain files recursively preservice folder structure DigiTalk Linux - Newbie 11 09-08-2005 08:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration