mv is a Unix command that moves a file to a target location.
Questions tagged [mv]
642 questions
20
votes
2 answers
mv directory and contents to new directory
I have a directory:
/var/lib/mysql/test_db/
which contains numerous files that make up the test_db database
I have now created a new directory:
/var/lib/mysql/data/
I am trying to move the test_db directory and it's contents into the data…

IGGt
- 2,457
17
votes
6 answers
How to prevent `mv` from moving a collection of files into a single regular one?
I've just lost a small part of my audio collection, by a stupid mistake I made. :-(
GLADLY I had a fairly recent backup, but it was still irritating. Apart from yours truly, the other culprit doing the mischief was mv, which will show as follows: …

syntaxerror
- 2,246
14
votes
2 answers
Why doesn't the free space on the source partition change during "mv"?
I am running mv to move a directory (which contains many files) from one partition to another. While mv is moving individual files in the directory one by one, I notice that the free space size of the source partition doesn't change, while the free…

Tim
- 101,790
8
votes
1 answer
Are there any dangers in using mv (instead of cp followed by rm)?
I'm a graduate student with access to a research group Linux cluster at my university. Over the years, I have accumulated many directories -- I guess "folders" is Windows/Mac terminology? -- in my home directory (~). When I'm working on a new…

Andrew
- 16,855
6
votes
4 answers
"mv" command-- file vanished into non-directory
I was attempting to utilize the mv command to move a file onto a remote server. I ended up executing the command...
mv sqlreport.php myuser@mywebsite.org
Unfortunately, this did not work. Worse, my file seems to have disappeared. A new file,…

Austin Yarger
- 117
4
votes
1 answer
The program mv waits till the end to delete files. Why? What can be done about this?
I'm using mv to move a huge folder from one hard drive to another and I noticed that it waits until the end to delete files it has successfully moved. Is there a reason for this? Is there a way to make it delete files as it goes or is there a…

Mr. Chem Question
- 211
- 2
- 5
2
votes
2 answers
Move every file that ends with 3 letter extension, but the last letter is either "g" of "f"?
mv public_html/*.??[g,f] public_html/images/
Could that work? So that all photos/images that have the extensions .jpg, .png, and .gif will be moved.
(I don't have Linux installed and I used an online terminal. Unfortunately, they don't have any…

licrux
- 21
2
votes
3 answers
Problem using mv
I was trying to use the mv command but I made a mistake. I had a file called relazione in a directory and I was trying to move it to another directory with the same name, so I typed:
mv relazione /relazione
The terminal didn't let me, so I…
2
votes
1 answer
Merely moving a directory inside another using mv
I just came across this weirdness: I want to do the equivalent of dragging a directory inside another (moving it). Trival day-to-day task for a GUI.
here is my tree:
.
├── assemble.py
├── Basic Information Retrieval.ipynb
├── Basic Information…

fccoelho
- 123
2
votes
2 answers
How to definitely move a file without overwritting anything
Is there a command or option that will allow me to move files without overwriting anything?
For the sake of argument, let us call the file foo.rar.
Now the -n sort of works, it won't overwrite the file.
But if a file is there it also won't move the…

Mouse.The.Lucky.Dog
- 2,037
2
votes
2 answers
mv multiple files same dir without specifying same path or each
If we have a dir/file setup like the following
var
|-->usr
| |-FileA
| |-FileB
| |-FileC
| |-FileD
How can I move FileA and FileD without specifying the path twice like in the following cmd?
mv /var/usr/FileA /var/usr/FileB…

Jackarter
- 29
- 1
- 2
1
vote
1 answer
Moving files to a new directory with a condition
I have 100s of files in a directory, and I want to keep only those where a part of first file matches with another file and if condition is not fulfilled than mv all files without its corresponding file, such as I have:
man_xyz_1.txt
…

Vinod Kumar
- 15
1
vote
2 answers
Working with graphics files and trying to rename sequentially with mv
I have been looking an older question answering a similar question, but apparently I am not too good at making the code work. I am on zsh not bash, but other bash shell scripts have worked fine, so I think that it is okay.
I have tried from prompt…

Mike Needham
- 13
1
vote
2 answers
mv multiple files from different folders from specific date
I have 3 folders f1, f2 and f3.
How can I move every file from f1 and f2 that the dates are from the 22 jun 2016 till the 21 of september 2018 to the folder f3, in one command maybe using mv?

hamza1QAT
- 13
1
vote
1 answer
mv removed/lost files after moving to subfolder
while working on my conky files I desided to put them neatly into a subfolder named .conky
these are the commands I ran:
$ ll .conk*
-rw-r--r-- 2 16K jan 28 12:09 .conkyrc
-rw-rw-rw- 1 6,7K jan 26 11:42 .conkyrc_bak
-rw-rw-rw- 1 7,0K jan 28 11:38…

Kuro Maii
- 13