Questions tagged [mv]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

Linux - Will the CP command overwrite an open file

I would like to know if I use the CP or MV command as root to copy a file to a new directory, which already contains that file and is currently open by another user, then would the operation succeed ...
Edward144's user avatar
  • 135
1 vote
1 answer
3k views

mv command deleted source files even though the file was not fully moved

I was using mv command to move multiple files from the directory A to directory B. The file system where the directory B is located was full, so I received corresponding messages. However, files were ...
Eli O's user avatar
  • 11
1 vote
2 answers
4k views

Files location after mv command without absolute paths

I have accidentally run mv command in folder to rename files. But I have forgot to specify absolute path (I did just mv old_name new_name). Now the files are gone. Any idea where those files are? ...
Marek Zak's user avatar
1 vote
1 answer
7k views

sed: cannot rename ./sed6x9apB: Operation not permitted using docker-compose with WordPress image

WordPress container fails to start when using docker-compose, where there are existing WordPress files, aborting with the following error: sed: cannot rename ./sedtpghTB: Operation not permitted ...
AndrewD's user avatar
  • 483
0 votes
1 answer
409 views

Linux Bulk rename media files and directories to place parentheses around the year at the end of the filename and directory name

I have a number of home video files in different directories that have a year at the end of the directory name to indicate the year that the video was filmed. It is also at the end of the filenames ...
Peter Freeman's user avatar
1 vote
1 answer
74 views

Shellscript - Reading filepath from textfile for restore

I'm working on a Recycle Bin script which I can call to delete a file and restore a file. The delete currently works fine and can be called using a wildcard, filename (for current directory) or a ...
William's user avatar
  • 11
0 votes
2 answers
52 views

Need MV command

I need to rename a file, but keep the extension (whatever it might be, without specifying it) For example: file_20161118.csv.ovr needs to be renamed to "file.csv.ovr". However in some instances it ...
James Sullivan's user avatar
1 vote
1 answer
78 views

Move multiple nested files up until they are only 1 directory deep

I have multiple files in multiple directories some buried under subdirectories. I want to be able to move all files until they are only 1 directory deep. for example: /home/folder/subfolder/file1....
Zach's user avatar
  • 11
2 votes
3 answers
6k views

mv command reports "X and Y are the same file", cifs filesystem

I'm trying to get a script that will rename and move videos. Here is what I have: #!/bin/bash src="/mnt/Files_Apps/temp/" dest="/mnt/Files_Apps/TFTP root/" for file in "$src"*.*; do newfile="${...
cgram's user avatar
  • 41
3 votes
3 answers
252 views

How to copy or move files -n levels up on OSX via shell

How can I find all files of certain type/name and copy them -n levels up? Here is the filesystem tree structure: germany/ | adventure/ | 300x600/ ...
Alexander Starbuck's user avatar
0 votes
0 answers
167 views

Is mv faster with --no-clobber?

I am about to move a lot of data from one place to another for a second time, because the first time I had no access to some subdirectories and files. I am not sure wheter the -n/--no-clobber argument ...
oddRaven's user avatar
  • 4,025
3 votes
1 answer
1k 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/...
Canaryyellow's user avatar
3 votes
4 answers
8k 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 "("...
chenyi1976's user avatar
0 votes
1 answer
183 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....
Ehab Mohamed's user avatar
2 votes
1 answer
2k 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 |...
Egon Olieux's user avatar
1 vote
1 answer
101 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 ...
FXux's user avatar
  • 157
0 votes
1 answer
91 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 ...
Grajdeanu Alex's user avatar
1 vote
1 answer
64 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 ...
user555132's user avatar
0 votes
1 answer
75 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 ---- -------- ------ ----------...
ohho's user avatar
  • 3,034
0 votes
2 answers
670 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.
Aryan's user avatar
  • 121
0 votes
1 answer
845 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 ...
Billy Leo's user avatar
0 votes
1 answer
4k 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 . -...
user3716621's user avatar
0 votes
1 answer
80 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 /...
DroidOS's user avatar
  • 127
0 votes
1 answer
66 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 ...
Meltemi's user avatar
  • 6,957
0 votes
1 answer
2k 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
Dave's user avatar
  • 23
2 votes
2 answers
500 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 /...
monkeymatrix's user avatar
2 votes
4 answers
2k 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-...
Fabien Snauwaert's user avatar
0 votes
2 answers
109 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 "-...
zocktol's user avatar
2 votes
2 answers
569 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 ...
Nolias's user avatar
  • 23
-1 votes
1 answer
339 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....
octosquidopus's user avatar
4 votes
3 answers
24k 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
user403723's user avatar
1 vote
0 answers
35 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.%...
A T's user avatar
  • 791
0 votes
1 answer
587 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/...
amimciptimdim's user avatar
0 votes
1 answer
4k 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 ...
David Ferenczy Rogožan's user avatar
2 votes
1 answer
874 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 ...
tomsv's user avatar
  • 403
0 votes
2 answers
178 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    └...
Roney Michael's user avatar
0 votes
3 answers
87 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 ...
Yanick Rochon's user avatar
0 votes
2 answers
930 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 ...
sachinruk's user avatar
  • 103
1 vote
1 answer
5k 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 ...
user2370460's user avatar
2 votes
1 answer
2k 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 ...
SuperAzeem's user avatar
1 vote
2 answers
9k 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 ...
Jeremy's user avatar
  • 173
0 votes
1 answer
80 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 ...
Will Ashworth's user avatar
1 vote
2 answers
8k 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 ...
noktulo's user avatar
  • 11
0 votes
1 answer
71 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 ...
mr. cooper's user avatar
0 votes
1 answer
329 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 ...
countunique's user avatar
2 votes
3 answers
1k 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 ...
Federico Ponzi's user avatar
12 votes
2 answers
2k 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?
user3032965's user avatar
0 votes
2 answers
1k 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/...
Michal Sapsa's user avatar
1 vote
3 answers
11k 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.)?
john's user avatar
  • 11
2 votes
0 answers
703 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 ...
Neil Belch's user avatar