Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mv]

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

1
vote
1answer
35 views

Move a range of numbered files and change their value

I've got numbered files (DSC_0001.jpg to DSC_0065.jpg), I know how to move them with mv DSC_{0001..0065}.jpg dir. I have no idea how to move them and change the range of values. mv DSC_{0001.....
1
vote
1answer
80 views

Renaming a file with mv: “cannot move to a subdirectory of itself”

I'm trying to rename a file using the regular mv command which has worked countless times before. $ ls -l |grep "Picture 001" -rwxrwxrwx 1 rolf rolf 657711 Feb 19 21:42 Picture 001_19.jpg $ mv "...
1
vote
0answers
12 views

OSX terminal: how to move thousand of files that match a specific name pattern [duplicate]

I have some 70,000 files (basically duplicates) most of which match a name pattern like name(1).ext, name(2).ext .... name(10).ext. However among these files there are others named name (xwz).ext. ...
1
vote
2answers
46 views

mv files with multiple `.` in the file name

I have some files I receive with names like (to many to do this manually everyday): AA.B.txt WW.C.txt and I want to rename them to AA_B.txt and WW_C.txt so that existing SQL code still functions as ...
0
votes
1answer
24 views

mv deleting files at the end instead of one by one

I am moving a folder recursively between two filesystems using mv -v. It seems like deletions happen at the end (in order to make mv transactional ?). I don't have enough space to hold two copies of ...
1
vote
2answers
133 views

how to rename all files under folder with specific extension name ( recursive approach )

we want to rename all files under /home/DB_home ( recursive ) so every file under DB_home will rename with .txt extension example before change /home/DB_home/hg/ir/qemu-ga /home/DB_home/td/...
0
votes
2answers
411 views

Moving files with extension from source to destination

Hello i am trying to move all files with .hi and .o extension from a target folder /src to another folder /Obj So far i have tried: srcpath=$(pwd)"/src" ghc src/Main.hs > Logs/output....
0
votes
1answer
44 views

Linux: Move files from unknown folder to unknown parent of the same unknown folder

Got your attention with that title, didn't I? LOL. Problem: I have a lot of folders that have a folder inside them, with files inside. I want to move the 2nd level files into the 1st level and do so ...
0
votes
1answer
446 views

moving files matching a pattern that catches the directory

Consider: $ ls foo xyfooz.tex $ find . -maxdepth 1 -type f -name '*foo*' -exec mv {} foo \; $ ls ./foo* xyfooz.tex I'm trying to achieve the same sequence of instructions only with mv, not find: $ ...
1
vote
1answer
34 views

Mv all files to Dropbox

I accidentally moved all files from the directory to the Dropbox folder: mv * ~/Dropbox/ That was not my intention at all. Now, Dropbox informed me that 1200 new files were uploaded, but I can't see ...
0
votes
1answer
267 views

What is the best and safest way to move files between HDDs in linux? [closed]

I have to move 5GB of data in certain folders (containing files smaller than 1MB) from an external HDD to another (both connected with USB 3.0). What is the best/safest way to make this transfer in ...
3
votes
4answers
1k views

Move files from subdirectories into single directory and prefix original directory name

I have a directory structure like this: ./a/1.png ./a/2.png ./a/3.png ./b/1.png ./b/2.png ./b/3.png ./c/1.png ... And I want to take all the files in the subdirectories and move them to a new ...
0
votes
1answer
105 views

accidentally clobbered directory using `mv` instead of `mv -t`

I accidentally did mv file /an/important/directory instead of mv file /an/important/directory/ or mv file -t /an/important/directory, so it now looks like /an/important/directory/ is clobbered. (I ...
0
votes
1answer
755 views

Fastest way to duplicate or copy or back up a directory with TB of data (image files) in it

Hi can you suggest an very efficient and high performance option to copy files (TB of data in the form of images are present) from one disk to another. I saw options like cp, rsync etc., but would ...
0
votes
1answer
91 views

What is the behavior of mv on /?

One of our users accidentally performed mv /* ../ without root permission. After checking the effects using diff I was surprised to find that mv apparently functioned as cp when applied to the / dir. ...
0
votes
0answers
236 views

mv command failed now file missing

So i ran mv command and it failed with mv: cannot stat ‘/root/HIDDENDIR/HIDDEN-DIR/recover.php’: No such file or directory And now file is missing from original and target directory. I even tried ...
0
votes
1answer
39 views

Mass checking and renaming for illegal characters in both files and folders

I wrote a python script in which it reads a text file that contains thousands of folder directory. While executing my script, I added in du -sch to try and get an approximate total size of all these ...
1
vote
1answer
492 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 ...
0
votes
1answer
568 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 ...
0
votes
2answers
733 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? ...
1
vote
1answer
2k 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 ...
0
votes
1answer
163 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 ...
1
vote
1answer
59 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 ...
0
votes
2answers
44 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 ...
1
vote
1answer
42 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....
2
votes
2answers
2k 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="${...
2
votes
3answers
97 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/ ...
0
votes
0answers
55 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 ...
4
votes
1answer
643 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/...
0
votes
3answers
2k 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
83 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....
2
votes
1answer
1k 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
90 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
49 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
49 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
44 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
428 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
561 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
1k 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
28 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
33 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
210 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
280 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
440 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
78 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
284 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
138 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
17k 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
31 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
351 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/...