LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-25-2014, 06:16 PM   #1
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 20
Posts: 154

Rep: Reputation: 18
How to undo moving a directory to a file (accident!)


Ugh, I meant to do "mv *zip www", but instead I did "mv * zip www"!! Now in the directory I've got just zip.www and all my subdirectories are gone. Is there a way to get my subdirectories back?

Thanks!!
 
Old 08-25-2014, 06:29 PM   #2
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
What is in www ?

With
Code:
mv * zip www
Move will try to move all files/dirs AND zip to dir www

Since I guess zip doesn't exist it present error
Also, mv will have refused to move the dir www to www (cannot move to itself)

The content of www should be what you are looking for
 
1 members found this post helpful.
Old 08-25-2014, 06:37 PM   #3
ziphem
Member
 
Registered: Feb 2004
Location: US / EU
Distribution: Fedora 20
Posts: 154

Original Poster
Rep: Reputation: 18
Thanks a ton for such a quick response!! Immediate panic meant immediate post! www was a soft link to "public", which I didn't realize immediately. I didn't think to check "public", convinced that everything should have all moved to www. I just went into "public" and moved everything back. That explains why I didn't see the www "directory" anymore, as it was a soft link and got moved into the directory "public."

Last edited by ziphem; 08-25-2014 at 06:42 PM.
 
Old 08-25-2014, 06:46 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
Ahh, ok

I never considered how mv * would behave with a symlink target dir

Purhaps it needs some 'logic' to catch such circumstances
 
  


Reply


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
[SOLVED] Invoke root directory owner/group while moving file/directory yogesh_attarde Linux - Security 5 04-15-2014 12:36 AM
[SOLVED] Unziping & moving(mv) a .sh file to user directory is adding(?) ^M to file lines waddles Slackware 7 12-13-2013 06:37 PM
I want to fuser to check if a file in my directory is being written to before moving linux_newb Programming 3 08-23-2013 09:22 AM
UNDO or similar for Thuna 1.4.0? Accidental file moving mechagojira Linux - Software 1 05-06-2013 12:13 PM


All times are GMT -5. The time now is 08:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration