LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 11-29-2011, 01:39 AM   #1
andrewshatnyy
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
Talking What mv file /Volumes/Samples/* does to you HDD


Guys I know it's messed up combination but I've just realized how smart I am.

I was trying to move zip file into one of the locations on remote drive:

mv ~/Downloads/zip.zip /Volumes/Samples/*



Of course all my files have disappeared including folders. ls -la won't show anything. Although volume indicator shows that there are files on it.

Any suggestions? Is that it?
 
Old 11-29-2011, 02:40 AM   #2
melinda_sayang
Member
 
Registered: Dec 2003
Location: Petaling Jaya
Distribution: Ubuntu
Posts: 475

Rep: Reputation: 31
Just rename it back.

mv /Volumes/Samples/* /Volumes/Samples/zip.zip.

But make sure you put your other stuff inside /Volumes/Samples into somewhere else. This works ( I tried it ) if the amount of the file is only one.

Edit:

This only happens if the /Volumes/Samples is initially empty.

Last edited by melinda_sayang; 11-29-2011 at 02:42 AM.
 
Old 11-29-2011, 02:56 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The * character is a wild card which expands to a sorted list of all the files and directories.

What does "ls /Volumes/Samples/" show?
In other words, what does /Volumes/Samples/* expand to? If the last item is a directory, you may have moved zip.zip and all files in /Volumes/Samples/ into a directory. All but the last item will be taken as files and directories to move.
If /Volumes/Samples/ has only on directory in it, that may be where the went to.

mv /Volumes/Samples/* /Volumes/Samples/zip.zip will not work right because it is selecting everything in /Volumes/Samples/. It will only work if there is one file in /Volumes/Samples, and that file used to be zip.zip.

If a file was renamed instead, and you don't have the extension to go by, try the "file" command. It analyzes what a file is by its contents (i.e. signature) and reports what the type of file is. Just don't blindly use wild cards in commands if you don't know what it will expand to.

Last edited by jschiwal; 11-29-2011 at 02:58 AM.
 
1 members found this post helpful.
Old 11-29-2011, 03:14 AM   #4
andrewshatnyy
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by jschiwal View Post
If /Volumes/Samples/ has only one directory in it, that may be where the went to.
You're so right !
There was one folder left but it was occupied with process so I thought that's all left.

I went ahead and check insides and yes all my stuff is there.

But mv /* /zip.zip was good advise too but it works if folder was initially empty.

Appreciate your explaining me.
Cheers
-A
 
Old 11-29-2011, 03:14 PM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
A safer way to run the mv command in cases like this is to use the -t option to explicitly specify the directory to move the files to. That way you're in less danger of permanently losing anything.

Also consider using the -n or -i option, or at least enable -v so you can see immediately what the thing did.

For example, there was at least one time where I ran multiple mv -f commands in a loop, and I ended up overwriting the same filename with one input after another, so that all but the last file was lost. That wouldn't happen with -t.
 
Old 11-29-2011, 04:19 PM   #6
andrewshatnyy
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
Smile

Thank you guys so much.
 
  


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
adding samples from one PCM file into another ryancuomo Programming 1 08-12-2009 01:34 AM
Hide dots file with (wIn) Explorer on mounted Linux volumes sylvaticus Linux - General 4 03-30-2009 07:18 AM
File system for large volumes archangel_617b Linux - Enterprise 2 08-30-2007 05:06 PM
Invalid File Credentials When Creating on NFS Volumes corbin.sl Linux - Networking 0 08-13-2006 01:05 PM
Volumes of file systems rasmib Linux - Software 1 07-24-2003 05:32 AM


All times are GMT -5. The time now is 04:55 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