mv is a UNIX command to move a file to another directory or rename it.

learn more… | top users | synonyms

4
votes
2answers
4k views

Using “mv” or “ditto” to merge folders in OS X

Used to the Windows way of doing I just found out OS X has no merge function – moving means replacing the folder. While this does make sense, I miss merging! I've two Wordpress directories, 1 ...
0
votes
1answer
183 views

Move files based on list of old and new file paths

What is an efficient way to rename files in OSX/BSD from a text file for files assumed to stay in original folder, but in the format of; /path/old file name.ext\tnew file name.ext There may be ...
1
vote
1answer
135 views

Move group of files into subdirectory

I want to move some ssh keys into a backup file. Specifically, I want to move id_rsa* into key_backups/, a subdirectory of .ssh. mv id_rsa* key_backup/ gives me back usage: mv [-f | -i | -n] [-v] ...
-2
votes
2answers
568 views

Mac (Linux) - Restore file removed through mv command

I have one big problem. I had two files - main.c and logic.c. I have used sed for some modification in logic.c and then i saved it to main_updated.c and then run mv main_updated.c main.c BUT it ...
3
votes
2answers
4k views

Move a range of numbered files?

I've got 291 numbered files (starting at 001 - title and ending at 291 - title) that need moved into separate directories. (001 to 021 to folder 1, 022 to 053 to folder 2, they aren't necessarily the ...
11
votes
2answers
734 views

mv command confuses directory name with command option

I have a directory called --pycache--, which I need to move to __pycache__. Using the mv command in the following way, gives me the listed output. How can I use the CLI to do what I want? $ mv ...
2
votes
5answers
4k views

Move all files in sub-directories to current directory?

I've got files in a bunch of subdirectories, and I'd like to flatten them out and move them all to the current directory. I found this question, but adapting the answer to: mv * . didn't work. I ...
1
vote
1answer
451 views

mv - move dir with destination-dir having the same subdirs as source-dir

In FreeBSD (I suppose it works like Linux et al in this regard), I'd like to move src_parent/mydir to dst_parent/mydir. dst_parent/mydir already exists, and it contains some subdirs that's also ...
-2
votes
3answers
666 views

Accidentally moved Desktop folder ingo /usr/local/bin

I ran mv -n /desktop /user/local/bin and as a result everything on my desktop is gone. I tried the opposite mv -n /user/local/bin /desktop in the hopes of undoing it but now only one of those ...
0
votes
2answers
649 views

make an alias to move files to a tmp directory

I am trying to create an alias to move files and directories to the tmp directory. This is what I've tried: alias rm='/bin/mv *.* /tmp' The problem is that when I type rm filename, I get an error ...
34
votes
5answers
2k views

In bash, how can I rename a file without repeating the path? [duplicate]

Possible Duplicate: Reuse text on a bash command If I want to rename a file a few directories deep, how can I avoid repeating the path? For example: mv path/to/old_filename.txt ...
8
votes
2answers
27k views

Move files and folders recursively in linux

ls -al ../public-back drwxrwxr-x 4 apache apache 4096 Apr 19 03:32 templates ls -al ../public-back/templates drwxrwxr-x 2 apache apache 4096 Apr 19 03:33 content drwxrwxr-x 2 apache ...
33
votes
6answers
10k views

What happens if mv is interrupted?

What happens if the Linux mv command is interrupted? Say, I'm moving a whole directory to some other place and interrupt it while it's moving. Will the source directory still be untouched?
0
votes
3answers
387 views

Mac OS: how could I rename a file like APP_001.gif to 01.gif?

I have a load of files in a directory. They all have names like: APP_001.gif APP_101.gif How could I bulk rename them to 01.gif 101.gif i.e. get rid of the prefix before _, and then remove the ...
6
votes
1answer
6k views

How to mv a folder in Linux retaining its mtime?

I am using CentOS 5.5 and would like to move a large amount of folders within one volume, retaining their mtime. The best solution I could find is like this: cp -p -r source/data target/ rm -rf ...
3
votes
1answer
4k views

mv: inter-device move makes moving a directory to a directory with same name a different operation?

Given: # mv /mnt/hard/git-src/ /usr/portage/distfiles/ mv: inter-device move failed: /mnt/hard/git-src/' to /usr/portage/distfiles/git-src'; unable to remove target: Is a directory ...
2
votes
1answer
455 views

XCopy on server?

Normally, on my website, files are either handled by WordPress or by me doing FTP. I'd like to copy my entire site to a new folder. I don't want to copy it down to my local drive (with wget) and then ...
2
votes
2answers
894 views

Literate way of moving all files to a new subdirectory

$ mkdir backup && mv * backup/ mv: cannot move `backup' to a subdirectory of itself, `backup/backup' Works, but issues a warning. Also exit code is 1. How to do it properly (but not [much] ...
2
votes
1answer
152 views

Don't move a directory/file if src and dest are on different partitions

In order to protect myself if I make a mistake in typing a directory/filename path, I am searching for a way to prevent mv from doing anything if the source and destination files exist on separate ...
2
votes
1answer
143 views

Bizarre mv operation

The use of a renaming program severely screwed up some of my files. I'm trying to get them back in order. I have file structure like this: ./Hello World/some-filename.ext ./Kitty Parade/another.ext ...
0
votes
3answers
3k views

Recursive move files of specific type to a specific path

In ~/my/path, I want to move all files that contain string "(J)" and have file type of ".foo" to ~/my/path/j I'm trying: [me ~/my/path]$ find -type f -name "*(J)*.foo" -print0 | xargs mv -0 j/ No ...
0
votes
2answers
994 views

How to move all files in a subdir to another dir

I have untar wordpress. It creates a wordpress dir. I want to move the files under this dir to mydomain.com dir but this doesn't work mv wordpress/* mydomain.com What's the syntax then ? Thanks.
4
votes
3answers
13k views

Unix Bash rename files using a regex

I would like to rename all files from a folder using a regex(add a name to the end of name) and move to another folder. It my opinion, it should be looking like this: mv -v ./images/*.png ...
6
votes
4answers
10k views

How to move only files in Unix

How can I move only the plain files (not the directories) from one folder in Linux to another folder using the mv command? I have tried mv * ~/, but it copied everything including the directories.
64
votes
12answers
90k views

How to move all files from current directory to upper directory?

How to move all files from current directory to upper directory in linux? I tried something like mv *.*, but it doesn't work.