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

250 questions
305
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
  • 3,053
236
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,485
34
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
  • 587
  • 1
  • 6
  • 13
32
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
  • 465
29
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
  • 569
22
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
  • 331
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
  • 22
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
  • 255
13
votes
5 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…
13
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,173
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…
11
votes
4 answers

How to exclude a folder when using the mv command

I have this situation where I want to exclude a directory while using the mv command. I saw this example where the syntax would be !(exclude_dir), but when I set up a scenario to test it I get results that I don't fully understand. Now I have…
George Udosen
  • 37,534
11
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