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

learn more… | top users | synonyms

2
votes
2answers
31 views

Moving all files from one folder to upper folder

I was searching the answer to question how to move files from one folder to upper folder and nowhere I have not found the answer mv name/* . Why I can't use this to moving files to upper folder? The ...
-1
votes
1answer
31 views

How to rename single-digit numbers to sort incrementally?

What is the simplest way to add 0's to all single-digit filenames to make them sort correctly? I'd like to stick to the command line if possible. From: a_1.png a_2.png a_10.png To: a_01.png ...
13
votes
2answers
897 views

What happened when I “mv *”? No errors were shown and now only one folder is left. Why?

The command executed was "mv space *" in a folder with 14 GB of data. mv * du -hs is the same so where has the 14 GB of data gone? What have I done?
2
votes
3answers
91 views

Linux mv command for moving multiple files with different extensions

I am wondering if it possible to use bash to mv multiple files with different extensions into one directory, for example mv 1.png 2.jpg dir/ except match many files
1
vote
0answers
25 views

move filename bar.filename, without mentioning filename twice?

How do I move filename to bar.filename without mentioning filename twice? In Bash I can just do: mv {,bar.}filename. I suppose I could do: set filename="foobar" && mv "%filename%" ...
0
votes
1answer
59 views

Mac mv command very slow

On my mac cp command works 9 times faster then mv. Why it is possible? Mac-Pro-AVM-4:2014-10-22 editor$ time cp /Volumes/AVM4_HD5/INGEST/Final\ Cut\ Original\ Media/2014-10-22/Clip\ \#13.mov ...
0
votes
1answer
108 views

`mv` creates a hard link instead of move or rename file or directory

I'm experiencing very weird issue with moving and renaming directories and files using mv I have never experienced before. The weirdest thing is that it's happening on Ubuntu as well as on Cygwin on ...
2
votes
1answer
42 views

What are the rsync equivalent command/s to mv /a/b /c/d?

What are the rsync equivalent command/s to mv /a/b/ /c/d/, i.e, to move a directory tree from one location to another, possibly on another file system? That is, not just copy, but delete the files ...
0
votes
1answer
43 views

Relocate jpg files from nested/buried structure to relative known directories

I'm trying to batch move/organize a large number of files (.jpg) from nested subdirectories to a relative directory. The structure is pre-planned. Just not 100% sure what the most efficient and safest ...
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 ...
0
votes
2answers
42 views

Simultaneously moving and renaming files in Red Hat

I'm running Red Hat Release 6.5 (Santiago). The problem I'm facing is that I have a bunch of files in the following directory structure: temp2 ├── ABC │   └── temp2 │      └── temp2.txt └── DEF    ...
0
votes
3answers
43 views

Moving folders in Linux inconsistency

I have a shell script that deploy an application to a staging server. However, one of the application's directory needs to be backed up and restored after the deployment (so it is not overwritten). I ...
1
vote
1answer
479 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 ...
4
votes
2answers
2k views

How to move multiple directories, but exclude files in current path with similar name?

Say I have a directory that contains the following: dir1/ dir2/ dir3/ ... dir50/ dir1.txt dir2.txt dir3.txt ... dir50.txt I have been using mv dir* /someotherpath/, then move the *.txt files back. ...
0
votes
2answers
44 views

Move a range of files

I have a range of numbered files (images) and I want to move them to subdirectory. https://superuser.com/questions/380338/move-a-range-of-numbered-files#= suggests that I use mv IMG_{001-022}.jpg ...
0
votes
1answer
354 views

Mac 10.6 - Unable to cp and mv files into ~/Library/Screen Savers/

I am trying to use Terminal to copy a file into ~/Library/Screen Savers/, but every time I try to do it, it fails. My command is: cp -r Web.saver '~/Library/Screen Savers/Web.saver' and the result ...
0
votes
1answer
47 views

mv command - how it works?

I was moving big sized directory (upto 10gb) using mv command and after some minutes I cancelled it (Ctrl+C). The mv process was then stopped and some of the files were copied to the destination ...
3
votes
4answers
1k views

Replace existing folder with mv command

Apologies if this question has already been asked, I couldn't find anything… Lets say I want to replace 'oldstuff' with 'newstuff'. Basically re-naming to replace. I try using this command: mv ...
0
votes
1answer
249 views

Prevent mv from overwriting the larger file by the same name

I need to move all files from a directory, discarding the directory structure. Unfortunately, some files have the same file name (Thumbnails). I'm looking for smth. like this: find /tmp/dirtree ...
72
votes
11answers
97k 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.
2
votes
1answer
407 views

Move all files in sub-directories to current directory while renaming duplicates

I have a number of subdirectories and I would like to move any files contained therein to the current directory using a one line Terminal command on the Mac. I know that my file names are not all ...
0
votes
0answers
115 views

Bash: move all files in all recursive folders to the root of the volume?

I have a disk with files and folders, a few levels deep. Eventually, there are mp3 files. What I would like to do is move *.mp3 from every level to the root of the disk, and then delete all the ...
1
vote
2answers
980 views

Permission denied when attempting to mv (sudo su userName)

I am currently working on a backup script to log into my production server and pull the latest SQL dumps to my staging server. I have no issue pulling the SQL dumps but I do have an issue with moving ...
2
votes
2answers
2k views

How can I log the output of the mv command in Linux?

I'm using the command: mv -v -f sourceDir destDir How can I output the verbose console out to a file?
0
votes
2answers
356 views

Linux move files from specific directory one directory up and delete empty folder

I need to move files out from a directory inside a directory inside a directory and remove folder that I move them from. I would need a recursive script. The directory structure: ...
7
votes
5answers
6k views

How can i move files with xargs in linux

I am trying this and its not working ls file_* |xargs mv {} temp/ Any ideas
37
votes
6answers
11k 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?
1
vote
2answers
735 views

Can files be recovered after a failed mv command?

I used mv * .. in Unix to move all contents of a directory to its parent folder. There was a folder called "Downloads" in both the current directory and the parent. The one in the parent was empty to ...
0
votes
1answer
48 views

I accidentally put a space in my path then moved lots of files - where are they?

I used the following code to move a lot of files: sourceDIR=/Volumes/MCOOPER/data destDIR=/Volumes/MCOOPER2 /data for i in {1..6000} do mv $sourceDIR/run$i.mat $destDIR/ done Now all my files are ...
0
votes
1answer
47 views

Using `mv` to rename a file in nested directory

Suppose I want to rename a file several directories down. I do, mv dirA/dirB/dirC/name.suf dirA/dirB/dirC/newname.suf Is there any easier way to type this? One option would be cd dirA/dirB/dirC mv ...
2
votes
3answers
65 views

Move all files in a directory in a subdirectory

I can't find a quick solution for this simple problem: I' ve got this tree: fatherDir -File1.txt -SomeFile.txt ... - A name.txt -sonDir I want to move all the files in fatherDir ...
2
votes
3answers
2k views

Move a list of files(in a text file) to a directory?

I have a list of files, with their full paths, one per line in a file "files.txt" I was trying to move all of those files from their original location to a new directory. I CDed into the directory ...
16
votes
3answers
1k views

Moving 2TB (10 mil files + dirs), what's my bottleneck?

Background I ran out of space on /home/data and need to transfer /home/data/repo to /home/data2. /home/data/repo contains 1M dirs, each of which contain 11 dirs and 10 files. It totals 2TB. ...
0
votes
2answers
327 views

how to use grep and mv together in a directory in shell?

how do you grep the contents of all files in a directory for "TEST" then move those files to a different directory(like the home dir.)?
1
vote
0answers
93 views

How to rename a folder in Linux?

I want to remove folder aaa and rename folder bbb to aaa. Both have subfolders in them. Seems simple enough using: rm -r aaa; mv bbb aaa However, any subfolders in bbb disappear where I would ...
11
votes
2answers
366 views

Linux mv command moved data to an unknown location?

I accidentally executed this command in SSH: mv /var/www/vhosts/website/httpdocs/magento/* Now all the data in the magento dir is gone. Does anyone know where it moved to? Thanks!
1
vote
3answers
447 views

mv: cannot move «file.mp4» to «/path/file.mp4»: Device or resource busy*

I simply try to move file to another path and I'm getting mv: cannot move «file.mp4» to «/path/file.mp4»: Device or resource busy* I've tried using lsof, but it's not showing any openfiles. lsof +D ...
-3
votes
2answers
2k views

“rm -rf /” VS. “mv -r / /dev/null”

Might be a stupid question, but what would be the worst for your system ? (I think both) But to my opinion mv would be the fastest to "delete" it all. Am I wrong ? (don't wana test aniway ^^ )
0
votes
0answers
24 views

Messed up wildcard mv, can it be fixed? [duplicate]

Sorry for the poorly written question, but I'm panicking right now. I accidentally mv prefix* instead of mv prefix* target_dir/ Now, there's only one prefix file left. Have I killed them? If so ...
0
votes
1answer
197 views

How do I create numbered backups?

Some GNU utils (e.g., mv and cp) can create numbered backups (foo.~1~). Others (e.g., wget) cannot. I would like to create numbered backups before running tools which overwrite files by default. Here ...
0
votes
1answer
904 views

Creating a tar with a absolute path

tar -cf /Users/Files/myfile.tar /Users/Files/ I am basically trying to create a tar containing the contents of User/Files and create it in the folder of the contents. I can only execute this ...
1
vote
3answers
351 views

Moving all files in current directory up one directory

I have installed wordpress onto my CentOS server. Now inside my /var/ww/html folder, I have a wordpress folder. I want to move all the files inside the 'wordpress' folder up into the parent dir, ...
2
votes
3answers
136 views

I used mv ./*/* to flatten a directory on a ntfs filesystem, without add . to the end of the command, now all of my files are gone

How can I recover these files? I used: mv ./*/* when it was supposed to be mv ./*/* . Now all of my files are gone.
0
votes
1answer
371 views

Why can't I mv a file?

I followed these instructions to remove Java from my Mac (Lion): http://stikine.wordpress.com/2012/03/02/howto-remove-java/ As part of the procedure, I needed to edit the file ...
10
votes
2answers
293 views

How to move folder in unix using mv, only when target is on the same drive

I need to move a folder using unix mv command, but only if the target is in the same drive or the same filesystem. What would be the best approach?
0
votes
1answer
98 views

Want to move file over network (not copy)

I would like to move file on network [Linux]. This is not working: mv {file} user@machine:/ How can I do this? And I prefer not using scp command to first copy and delete.
0
votes
2answers
697 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 ...
7
votes
4answers
11k 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.
2
votes
1answer
356 views

Removing a directory containing a file using find

I'm searching a list of directories for certain files and I want to delete the directory that the file is in. This is what I'm trying: find /converter/storage/unmatched/ -size -4b -name '*.mp3' ...
0
votes
1answer
185 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 ...