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

learn more… | top users | synonyms

0
votes
1answer
16 views

Overwrite file from old folder to new folder

I have 2 folder: - /Desktop/old - /Desktop/new In old folder, I have following file: - olda.txt - oldb.txt In new folder, I have following file: - newa.txt - newb.txt - newc.txt And I want to ...
1
vote
2answers
163 views

What command should I use to move these particular elements?

Here is my initial situation: In a folder named for example Father, are stored some files in the following way: Father contains 24 children folders (let's call them Child1, Child2, ...), and each one ...
-2
votes
0answers
28 views

Linux command line: How to move all files except those with a certain extension? [duplicate]

I have a folder with a bunch of files and .sh scripts. I want to move all of the files except the scripts to another folder. I am not looking for a bash command just a regular command which I can type ...
1
vote
1answer
41 views

Batch renaming of files with ascending number

I have a batch of files: $ ls Li1Fe1O2_11 Li1Fe2O3_8 Li1Fe3O4_2 Li1Fe3O4_5 Li2Fe1O3_16 Li2Fe2O4_12 Li3Fe1O4_19 Li3Fe1O4_22 Li1Fe1O2_14 Li1Fe2O3_9 Li1Fe3O4_3 Li1Fe3O4_6 Li2Fe1O3_17 Li2Fe2O4_13 ...
1
vote
1answer
8 views

Only move folders not existing in target directory

I am looking for a way to move folders that are not already present in the target directory on my linux server. Example: Target directory folder1 folder2 folder3 folder4 Source directory folder1 ...
1
vote
1answer
21 views

Cant find folder after mv command

I was working on a backend, and decided to make a git repository for the whole app. So after cloning into my home directory, this is the list of commands: ~$ mv PartySpotBackend /PartySpot mv: cannot ...
4
votes
1answer
53 views

Is it possible to add a password to moving or copying specific files on Linux?

I have a directory setup very nicely(i.e organized with READMEs and easy navigation etc.). I would like people to be able to access the files in this directory maybe even copy them to their own ...
4
votes
3answers
70 views

How to remove space in all sub directories in shell script?

I tried following shell script to remove all spaces with underscores: find $1 -depth -name "* *" -print0 | \ while read -d $'\0' f; do mv -v "$f" "${f// /_}"; done If I have a directory ...
7
votes
2answers
543 views

How to replace spaces in all file names with underscore in Linux using shell script?

I tried following shell script which should replace spaces from all xml files for xml_file in $(find $1 -name "* .xml" -type f); do echo "removing spaces from XML file:" $xml_file mv "$xml_file" ...
0
votes
2answers
58 views

File exists but mv errors out with: “mv: cannot stat ‘file.tar.gz’: No such file or directory”

I am creating a script in Centos 7 to move the latest file within a directory to another directory. The original directory that I'm copying from contains a valid file, however when I try to move or ...
1
vote
1answer
23 views

Deny permission to move a soft link

I have a soft link that was accidentally moved as a result of a user drag/drop operation in a Filezilla UI. Is there a way to prevent a user from moving the link but leaving all other permissions ...
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
118 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
56 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
186 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
220 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
32 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
58 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
54 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
152 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
343 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
100 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
162 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
87 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
67 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
83 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
87 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
118 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
210 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
145 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
118 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
45 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
38 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
68 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
44 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
62 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
193 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
68 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
99 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
97 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
80 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
48 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
50 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
162 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
155 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
197 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
69 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
65 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 ...