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

learn more… | top users | synonyms

3
votes
1answer
36 views

Bash move and rename by parsing the output of find

I have nested directories of pdf files and I would like to extract them to a higher level directory renaming them as follows: My files are something like: ./path1/pathA/fileI.pdf ./path1/pathB/...
-1
votes
2answers
99 views

How to batch rename files by removing special character without using rename in linux shell

For example, I have 100 files and their names all have blank space. One of them is "The Monkey King Return (2015).mkv". How to remove all blank in name and replace with dot character, also remove "("...
0
votes
1answer
18 views

Rename php.ini.default to the more recognizable and standardized php.ini

When I type command: mv /etc/php.ini.default /etc/php.ini I get: bash-3.2# mv /etc/php.ini.default /etc/php.ini mv: /etc/php.ini....
1
vote
1answer
151 views

Cannot move ./test to a subdirectory of itself, './test/test'

When trying to convert some files to lower case I noticed something which seems strange to me. When executing this in bash: find . -iname 'test' | while IFS='\n' read item; do mv $item $(echo $item |...
1
vote
1answer
64 views

Find files with string

How can i grep e move pdf files that containing the string "RELAÇÃO DOS TRABALHADORES" inside? Using ubuntu 14.4. I already try to use: grep -i -Z -r -l 'RELAÇÃO DOS TRABALHADORES' . | xargs -I{} mv ...
0
votes
1answer
18 views

How to use mv command to remove unwanted character from multiple files in the same directory

I have in a directory some files: agent_datad.bin _codecs_cn.cpython-34m.so _Crypto.Cipher._ARC4.so Crypto.Hash._RIPEMD160.so ... other files How can I remove the _ from the beginning of each file ...
1
vote
1answer
32 views

files dissapear when I run mv command

I use the below command to move files: mv *.gz directoryname but directory name has spell mistake and the file with directory name has been generated with unknown format. And I lost my file. How ...
0
votes
1answer
27 views

Is it safe to mv files to and from two drives simultaneously?

I have two disks on my Synology DS215j. Disk 1 is /volume1 and disk 2 is /volume2. size of folder disk capacity free to move from ---- -------- ------ ----------...
0
votes
2answers
77 views

move command in linux to move multiple files of same extension but of different year

I have some 500 .txt files from the year 2013 to 2015 placed in a folder and I need to move all the files of the year 2013 and year 2014 to some oher folder.
0
votes
1answer
171 views

mv command lost all files. Can find files by locate function but not in file manager

I was trying to move all Video files(not Directory) from withing my Downloads folder to the Videos folder... I assumed I was safe as in my mind move is not delete. I may be learning that this is the ...
0
votes
1answer
185 views

how to move files that contain string using find, xargs, grep, in linux

i have many php files maybe over Three million.. how can i use grep with xargs and find with mv to find contain the string in files and move them to directory if they match. I try like that find . -...
0
votes
1answer
17 views

Selectively find and move specified files to folder [duplicate]

I need to place the whole set of the Google web fonts in a single folder on my Ubunu 14.04 server. I have downloaded the current snapshot from Github which upon expansion gives me the structure /...
0
votes
1answer
16 views

Zsh: prepend $(<list.txt) args with a directory

I'm using cp $(<list.txt) new_folder to copy a list of files (filenames in list.txt) to a new folder. As is the files must be in the same folder as list.txt. Is there an easy way to make this work ...
0
votes
1answer
26 views

How do I move all files except those that begin with a “.”?

I'm using bash shell on Mac 10.9.5. Within a certain directory, how do I move all non-hidden files -- taht is, all those that don't start witih a "."? Thanks, - Dave
2
votes
2answers
160 views

User moved root directory into subdirectory, or tried to, machine unresponsive

A particularly special user of mine inadvertently ran a command to move files that looked something like this: mv /* /home/ubuntu/GS14K/ This led to a series of errors: mv: cannot move /bin' to/...
2
votes
4answers
143 views

bash extract first number from filename

I'm trying to move files like this: ... DLG023-00-01-sprite.TextGrid.json DLG023-00-01.prosody.json DLG023-01-01-sprite.ogg DLG023-00-02-sprite.TextGrid.json DLG023-00-02.prosody.json DLG023-01-02-...
0
votes
2answers
30 views

Using MV to rename large amount of files using a script

I'm writing a bash-script to rename a large amount of files, using mv. Original filename File001.txt New filename file-new-001.doc I can change the suffix but i do not know, how to insert the "-...
2
votes
2answers
102 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
56 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 a_02....
3
votes
3answers
7k 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
28 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%" "bar.%...
0
votes
1answer
156 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 /Volumes/...
0
votes
1answer
513 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
220 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
2answers
80 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
56 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 ...
0
votes
2answers
69 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
2k 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 ...
-1
votes
1answer
146 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 ...
1
vote
2answers
4k 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 ...
0
votes
1answer
54 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 ...
1
vote
2answers
2k 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
50 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
60 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
79 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 ...
13
votes
2answers
929 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?
0
votes
2answers
472 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: /Folder0/...
0
votes
2answers
1k 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
117 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
426 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!
2
votes
1answer
632 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 ...
1
vote
3answers
695 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 ...
0
votes
0answers
25 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 how/...
18
votes
3answers
2k 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. /home/...
0
votes
1answer
413 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
1k 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 ...
4
votes
4answers
3k 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 ~/...
2
votes
3answers
498 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, ...
-4
votes
2answers
3k 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 ^^ )
2
votes
3answers
151 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.