Questions tagged [mv]

Tag for questions about the terminal command "mv" to move and rename files.

Use mv SOURCE DESTINATION, to move the file(s) or folder(s) SOURCE to the DESTINATION.

If SOURCE and DESTINATION are both of the same type (file or folder), the command also renames the object.

For full manual type in a terminal window: man mv

242 questions
279
votes
8 answers

mv: Directory not empty

I want to move content of a directory within another directory with the same folders. Here's an example: I have ./backup which has the directories base and test. Now, I want to move these directories to ./backupArchives. I use this: mv ./backup/*…
UdK
  • 2,793
  • 2
  • 13
  • 5
224
votes
15 answers

How to move multiple files at once to a specific destination directory?

I got a bunch of files in some directory (along with many other files) that I want to move. Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep IDENTIFIER to get the exact list of files to move.…
gilad hoch
  • 2,365
  • 2
  • 20
  • 12
33
votes
3 answers

"mv file" and now it's missing

In a terminal window, I typed: mv filename ..\.. [Note the wrong slash.] Now I can't find it. Gone. I ran some searches and looked through recoverable deleted files. Nothing. Poof. Serves me right for using a Windows machine right…
John
  • 577
  • 1
  • 6
  • 13
29
votes
4 answers

mv files with | xargs

I'm just trying to move a bunch of files (not symlinks) out of my /etc/apache/sites-enabled folder into the /etc/apache/sites-available folder with the following: /etc/apache2/sites-enabled$ find . -maxdepth 1 -type f | xargs mv {}…
Rob
  • 415
  • 2
  • 5
  • 7
27
votes
2 answers

mv fails with "No space left on device" when the destination has 31 GB of space remaining

I've been trying to move 32.6 GB of files to a folder on an external flashdrive to free up space on my laptop's SSD. After opening up the source folder in Terminal (and running ulimit -S -s unlimited to keep mv from throwing up), mv *from*…
Vikki
  • 529
  • 1
  • 7
  • 15
21
votes
4 answers

Why does moving some files in a folder take longer than moving the whole folder?

I have millions of images on my ubuntu cloud server. When I move a complete folder containing 12 million images using mv command, it happens almost instantaneously. However, when I mv only images(not the folder) then it takes some time. Is there a…
sankit
  • 321
  • 1
  • 2
  • 10
19
votes
1 answer

Moved a directory to an unknown .../ place (three dots)

I came across this weird situation when I accidentally moved one of my directory to an unknown place I am unable to find. What I did was executed this command - /opt/lampp/htdocs/cake$ mv cakephp/ .../ It did executed without any error, and now I…
Hirdesh Vishwdewa
  • 411
  • 1
  • 10
  • 21
14
votes
3 answers

Revert moving root directory recursively

I have an Ubuntu Desktop used as a Server. This morning I accidentally moved all my root to ../ root@server:/tmp/UPS/up/upsilon# mv /* ../ mv: impossibile spostare "/dev" in "../dev": Dispositivo o risorsa occupata mv: impossibile spostare…
MaxDL
  • 143
  • 1
  • 5
13
votes
1 answer

How to move some files to their parent directory?

I want to pull all mp3's that accidentially have been put into a flac folder out of it, to their parent folder. It should not matter how deep the folders are, I just want to move the matching files exactly one directory up. Here's how I select my…
Marcel
  • 245
  • 3
  • 11
13
votes
4 answers

Simulate action of mv command

I'm moving some files around, and I want to make sure that the mv command I've typed is correct before I go ahead and run it. If I was using apt-get, I could use the -s flag to perform a simulation that would actually do anything. Does mv have a…
starbeamrainbowlabs
  • 1,187
  • 3
  • 17
  • 36
13
votes
1 answer

How do I get back files after "mv * .*"?

I hid some files using the command: mv * .* but now I am unable to find them. I tried using: mv .* * but nothing happened (an error was shown). If I run: ls -la it's showing: total 8 drwxrwxr-x 2 abhishek abhishek 4096 Mar 9 20:46 . …
12
votes
3 answers

Change directory to target of move operation

Occasionally, I have edited some file and want to move it to a different folder. (Typically: to a Dropbox folder, where I did not want to work to avoid giving the other owners of the folder constant updates.) I do this, for example, with mv…
Mees de Vries
  • 457
  • 3
  • 14
11
votes
2 answers

move files matching a specific pattern

How can I move files in a folder with a specific pattern to the destination folder? I want to move files with names in the range [00-09] in the 4th column when separated by delimiter "-". ls | cut -d "-" -f 4 | grep ^[00-09] Shows these…
r.bot
  • 113
  • 1
  • 1
  • 5
11
votes
3 answers

mv command - don't overwrite files

I want to mv files and not overwrite duplicates. The -b switch only makes a single backup file, whereas I may have many. According to the mv man page: The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control…
BeMy Friend
  • 1,013
  • 5
  • 14
  • 19
10
votes
4 answers

How to copy (or move) files from remote machine to local machine?

I SSH tunneled from my local Ubuntu machine to a remote Ubuntu machine and I want to copy/move files from the remote Ubuntu to the local one. I need to do that from within the SSH session (i.e, from within the remote Ubuntu). These didn't work: scp…
user423047
1
2 3
16 17