typo in move command - files gone now?
So I was moving some files from one drive to another and made a small typo.
Code:
zero@MythBox ~ $mv -v /media/Software/* /media/Documents/Software/* |
"*" is a wildcard which essentially matches whatever it can find. I just did a test: I sent some files to dir1/dir2/* (dir2 was empty). The mv command reported (correctly) that dir1/dir2/* did not exist.
I then created a new directory ("new") in dir2. After issuing the mv command as before, the files appeared in dir1/dir2/new. What happens when the target directory has more than 1 sub-dir? I tried the same thing with TWO directories and it moved the files into one, and then moved the other directory in there also. I will have to think about why......:confused::confused::confused: Meanwhile, what all this tells me is that your files are in a subdirectory in /media/Documents/Software/ |
All the expansion is done by the shell before it starts mv. Therefore, if the target directory has more than one subdirectory, mv will see:
mv x y z dir/sub1 dir/sub2 targ/dir1 targ/dir2 and it will happily move everything but the last argument into targ/dir2 if it is a directory, and present an error if it is not. What is the output of: ls -Fl /media/Documents/Software |
Quote:
The OP's command line expanded the wildcards and only the last argument is the destination. If it was a directory, all sources were moved to that directory, if it was a file the shell would have spit out an error message like: "mv: target `something' is not a directory. Quote:
|
Quote:
Here's what is non-obvious: Suppose I have the following: Code:
$HOME |
Where it gets really confusing for new users is if the source or target directories contains whitespace
mv x y z dir/* targ/* where targ contains "a dir" and there is a ./dir in the current working directory of the mv command. |
Thanks for the explanations guys.
I did manage to find the files in a subdirectory inside software/. |
All times are GMT -5. The time now is 02:43 PM. |