mv is a Unix command that moves a file to a target location.

learn more… | top users | synonyms

0
votes
1answer
26 views

Folder organization

I have several folders ("amazon", "niger", "rhine",...). Inside each of them I have several subfolders ("gfdl", "hadgem", "ipsl",...). Each subfolders is composed by 5 subfolders (e.g. in "amazon", ...
0
votes
1answer
60 views

Operation of “mv” described in “Advanced Programming in the UNIX Environment”

In Advanced Programming in the UNIX Environment (book) Section 4.14, interpret the i-node and directory, there is a paragraph: When renaming a file without changing file systems, the actual ...
2
votes
2answers
106 views

Rename a set of files with pattern <name>.1.gz.html to <name>.html

I tried to use the command: mv *.1.gz.html *.html But, I got the response: <filename> is not a directory. How can I get this working? I tried the rename command as well, but, I couldn't ...
2
votes
2answers
61 views

What's the appropriate way to do “mv ./* ./subdirdir/”? [duplicate]

Under the current directory I have a number of files, and one directory. I would like to move all files to the sub directory: mv ./* subdir/ cannot move ./subdir to a subdirectory of itself... The ...
1
vote
1answer
52 views

Move files from multiple directories to another system

Let's suppose I have a folders in the source system: AB1, AB2, AB3. And I have the same folder names AB1, AB2, AB3 in the destination system. I want to move AB1 files to AB1 and AB2 files AB2 and ...
5
votes
2answers
153 views

Why does renaming a file with mv command alter an inode's “change” date & time?

A file hello.c is renamed to hi.c. As the output of stat command shows, [change] time stamp has been changed. usually it is changed when inode of file got modified. Why renaming with mv command ...
3
votes
5answers
165 views

Use of find command to rename files

I have a list of 10K mp4 files some of which contains a ? mark. I need to replace these with _ (underscore). I can use find command to find these files but not sure if I can rename them. find . ...
2
votes
1answer
28 views

Move only on verify?

For some reason, copying files from my phone over the MTP fuse interface sometimes results in corrupt files, missing their last few bytes. I want to remove each file on successful transfer, but not ...
1
vote
1answer
42 views

Moving files modified after a specific date [duplicate]

How do you move files modified after a specific date (say 7 days for example) to another directory? I clumsily tried sending the output of ls -t | head -n XX But learnt recently that it isn't a ...
2
votes
3answers
49 views

Move file and preserve owner and mode in one atomic operation

Is there a way to move a file and preserve original owner(group) and file mode in one atomic operation? So there will not be change for others to access moved file in time when is not already set ...
3
votes
1answer
116 views

Unix NFS Mounts and Moving Files

Had a question on NFS mounts and how they interact with transferring files on a low level. I'm trying to understand the latency involved with transferring files from within the same mount. Say you ...
3
votes
3answers
300 views

How to move subdirectories into another subdirectory within the same directory?

There is a directory dir/. It contains subdirectories a-z. I need to move subdirectories a-y into subdirectory z. If that's hard, then not a-z, but by providing a list of directories that need to be ...
1
vote
1answer
92 views

I've moved my root directory accidentally to a folder, can't figure out how to move it back using busybox [closed]

I've moved my root directory into a website folder in /var/www. Have rebooted my server and am now in a Busybox rescue environment where I have found my root files in the website folder that I tried ...
3
votes
7answers
151 views

find files based on name and moving them with renaming simultaneously

Consider I've directories named according to years and containing pdf files according to subject-code. ls output is: $ ls -l total 32 drwxrwxrwx 1 root root 4096 Apr 8 08:52 May-June-2011 ...
2
votes
2answers
80 views

How to restore a folder that seemingly disappeared after using mv?

I moved/renamed a folder with .svg-figures using mv fig figs. In my mind, this should have renamed the folder 'fig' to 'figs'. Accordingly, the output from ls showed a folder named 'figs' when I ran ...
0
votes
1answer
61 views

command “find … -exec mv …” created a file with strange content

I wanted to move binary files from folder /myhome/sourcedir to /myhome/targetdir. I used a command find /myhome/sourcedir -type f -cmin +3 -exec mv '{}' /myhome/targetdir ';' Folder /myhome/sourcedir ...
2
votes
1answer
70 views

Moving /usr/lib without breaking everything

I want to move this directory in following way: sudo mv /usr/lib /tmp/bad_files/ sudo mkdir /usr/lib sudo mv /tmp/bad_files/lib/* /usr/lib/ Why do I want do do this? I have filesystem-related ...
1
vote
1answer
54 views

File corruption using rsync, multiple rsync processes, moved/renamed source file

I'm encountering some file corruption when using rsync (that is, the file contents do not match the source file). I can understand the file becoming corrupt if it is being written to while being ...
2
votes
2answers
111 views

Make rsync move (not copy) files on local file system

Can I make rsync to move large amount of files instead of copying them when on local filesystem? I would like it to behave like improved mv command. I know about --remove-source-files option but ...
3
votes
3answers
201 views

How do I determine a file's original location?

I used mv to move all files matching a specific pattern into a folder. How can I determine (after moving files) where a specific file came from? Is there any chance of determining the location after ...
3
votes
0answers
120 views

mv to nfs “cannot create regular file … file exists” but creates empty file

I have an automated script that moves data files from the computer that they're collected on to a central NFS server for more general access. I've recently been seeing about 1% of files failing to be ...
2
votes
1answer
105 views

Are there any dangers in using mv (instead of cp followed by rm)?

I'm a graduate student with access to a research group Linux cluster at my university. Over the years, I have accumulated many directories -- I guess "folders" is Windows/Mac terminology? -- in my ...
0
votes
2answers
40 views

mv directory and contents to new directory

I'm sure this is probably a really daft question that may have been answered before (I'm still new to Linux - so sorry in advance), but I've searched high and low and can't find the answer. I have a ...
3
votes
1answer
37 views

Moving sub-directory to new parent directory where the new directory name is incremented by 1

I am attempting to move a sub-directory from one parent directory to another for hundreds of instances, while changing the name of the sub-directory during the move. My directories are a set of ...
1
vote
3answers
67 views

Improve `mv` to require explicit specifying target?

I have hit some errors due to not specifying the target properly when using mv. For details, see: Mistake of using rm What does `mv ./*` without specifying destination do? Can we make mv more ...
1
vote
1answer
42 views

mv to file with

I ran the following mv command, apparently by mistake using backslashes by mistake instead of slashes. mv 2015-02-02_flyer_ppces.pdf ..\PPCES2015\2015-02-02_flyer_ppces.pdf The output is empty. ...
1
vote
1answer
59 views

How directory permissions remain same after mv command?

There are two user A & B. sharing same server. A has created a directory with permission 700 and both user and group are same i.e. user A e.g. drwx --- --- A A temp_dir/ Now user B has ...
2
votes
4answers
156 views

Find and move with exclude

I need to use find and mv together requirement : Need to find all file *.xml but exclude deposit.xml and move it to another folder ( fairly simple) My attempt : mv `find ./*.xml '!' -type d | ...
1
vote
1answer
55 views

Extracting the Contents of tar archive to parent directory issue resulting in creation of sub directories

I have a Tar file: testwebsite.tar I've placed it in the directory I would like to extract its contents to on my Web server which is mytestdirectory I run this command via PuTTY: tar -xvf ...
1
vote
1answer
85 views

Extracting Wordpress.zip file on Linux server

I'm new to Linux and I'm currently trying to do the following: unzip the contents of wordpress-4.1.1.zip to the directory in which it is contained which is /my-test-site/wordpress-4.1.1.zip I ...
1
vote
1answer
94 views

Will `mv` ever have the ability to create directories?

This question asks for the best way to create a directory when using mv if it doesn't exist. My question is why isn't this an inbuilt feature of mv? Is there some fundamental reason due to which this ...
0
votes
3answers
70 views

Renaming multiple Files, Bash Script, preferably with an Addition

Hello you wonderful people, I have a little problem creating a Bash Script. I have 7000 image files (dicoms). These files belong together and should be in order in ONE directory. However, the program ...
1
vote
1answer
44 views

Files missing after using mv and parameter substitution in a loop

Related questions to missing files after mv don't appear to answer my question. The following commands were run within the working directory where the files are located, resulting in missing files. ...
1
vote
2answers
43 views

move content from a folder with unknown name up one directory

I have data arranged as follows: --parent_dir | --4Bz27go1c | -- foo.md -- bar.tar.gz -- baz.c .. I have a parent directory with a known name and a child ...
0
votes
1answer
136 views

rename multiple files with one variable

I am trying to rename one file with one variable. Example: 2014.001.**.**.**.D890.E.m to IP.PMST..BHE.D.2014.001. My script is: #!/bin/bash cd /home/pintolcv/Downloads for jd in {001..366} do ...
1
vote
2answers
138 views

linux/bash equivalent of mv -t

ls -al | grep -v '^d' | xargs mv -t mysubdir I use the above command extensively on Red Hat systems. It moves all files in the current directory to mysubdir $ mv --version Usage: mv [-f] [-i] [-e ...
2
votes
2answers
171 views

Move file to another user's home directory (without sudo)?

I have a couple of files that I want to move to another's user home directory. I don't have permissions to write to that user's home directory, but I know his password. I know how to copy the file ...
1
vote
3answers
67 views

Replace bunch of files maintaining path

I have directory A and B. Each of them contains another directory with item.json inside. Only item.json file is persistent in directories so I cant copy-paste the directories. A: ./path/Item ...
-6
votes
1answer
62 views

How to know where a file was before it was moved [closed]

Why does find match all the files when using it like this? find ~/ "*.pdf" So, I accidentally messed up with my home directory and moved all the files into ~/Documents. Is there a way to undo ...
10
votes
2answers
428 views

Why doesn't the free space on the source partition change during “mv”?

I am running mv to move a directory (which contains many files) from one partition to another. While mv is moving individual files in the directory one by one, I notice that the free space size of ...
1
vote
4answers
3k views

rename multiple files with mv

I want to rename a couple of files in the same directory. When you start to google this there is plenty of help available. What i saw the most if you only want to change the extension is mv *.txt ...
3
votes
2answers
124 views

Atomic removal of directory

Because rename(2) is called by mv, is it safe to assume the following would be atomic? $ mv /home/me/someDir /tmp/toBeDeleted $ rm -rf /tmp/toBeDeleted
0
votes
1answer
33 views

Tried to mv folder, now having trouble finding folder

Yeah, so I was trying to move a folder around, and now I'm having trouble finding it. Originally it was in my .../Downloads/ directory. I did: sudo mv Downloads/Blah/ ~/ ... which seemed to work ...
0
votes
1answer
60 views

Is it a bad habit to move things to tmp?

Im not sure what type of issues this could cause (might be none, of course). But when I had a folder a few days ago that could not be deleted even after running: chflags nouchg -R and then sudo rm ...
2
votes
2answers
491 views

mv command error “already existing file”

I am using a simple script to create some directories. Finding some specific files by name and then moving them into the directories that I have created. The code that I am using is below: mkdir ...
3
votes
0answers
37 views

Rename file with the name from a variable [duplicate]

I want to rename an image with the text in that image. For that I use an OCR and I try to store the name in a variable and use that variable in the mv command but I get mv: target ‘file’ is not a ...
0
votes
2answers
3k views

how to rename multiple files by replacing string in file name? this string contains a “#”

How to replace a text string in multiple files in Linux How to rename multiple files by replacing word in file name? Replace string in files with certain file extension Searching a number of files ...
1
vote
2answers
193 views

mv multiple files same dir without specifying same path or each [duplicate]

If we have a dir/file setup like the following var |-->usr | |-FileA | |-FileB | |-FileC | |-FileD How can I move FileA and FileD without specifying the path twice like in ...
2
votes
2answers
123 views

How to find a specific file and move it to a specific directory?

How to find a specific file, and move it to the specific directory /var/tmp? For example I want to find the file 0914_Jul-2014.gz. Remark, the file 0914_Jul-2014.gz, is under ~300 subdirectories: ...
1
vote
3answers
51 views

Moving files recursively if certain condition is met

I have the following directory tree: records/13/2014.12.16/00/05.mpg records/13/2014.12.16/00/15.mpg records/13/2014.12.16/01/05.mpg records/13/2014.12.16/02/15.mpg records/15/2014.12.14/05/25.mpg ...