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

learn more… | top users | synonyms

1
vote
0answers
25 views

Restore Trash Script not working

I made a script to send a file to a trash folder... echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f "$1")" >> ...
0
votes
1answer
13 views

Cannot stat error?

Running a "restore" script which moves a file previously deleted (moved to a trashbin folder) back to where it came from. Running the secondary script I receive this error... "mv: cannot stat `test': ...
12
votes
6answers
805 views

How to prevent `mv` from moving a collection of files into a single regular one?

I've just lost a small part of my audio collection, by a stupid mistake I made. :-( GLADLY I had a fairly recent backup, but it was still irritating. Apart from yours truly, the other culprit doing ...
1
vote
1answer
37 views

Rename bash script - false no such file or directory error

I am trying to rename a few hundred files based on another file in the same directory. I found a script and with modification I have the following: while read file; do echo mv ...
4
votes
2answers
98 views

Can multiple mv commands be run in the same directory (race condition)?

I'm moving a large number of files (400K+) from one directory to another and I have the following script to do so (too many files for the mv command to work directly): for file in *; do mv $file ...
24
votes
2answers
1k views

Is it safe to move a file that's being appended to?

I have a node.js process that uses fs.appendFile to add lines to file.log. Only complete lines of about 40 chars per lines are appended, e.g. calls are like fs.appendFile("start-end"), not 2 calls ...
2
votes
3answers
112 views

How to remove file with mv command?

I started to study Solaris in my university. Teacher told me to remove a file with mv command. I tried to move a file to /dev/null. But that did not work. How can I remove file with mv command?
0
votes
1answer
33 views

adding unzipped files to a zipped folder

I'm trying to add unzipped files to an existing already zipped folder say new folder.zip. Is it possible to use zip -r new folder.zip after adding some unzipped files to them. Will this command ...
2
votes
1answer
54 views

What happen if accidentally move a soft link followed by “/”?

I created a soft link to the current directory, $ ln -s "$PWD" math I then wanted to move it to another directory. $ mv math/ ~/dirlinks/maths/ I then realized I should $ mv math ...
0
votes
1answer
62 views

moving files to a folder and zip the folder

I have to zip a few files induvidually from folder A and move them to folder B on the same directory which takes lot of time. So I thought of moving all those files to be zipped to a new folder(c), ...
2
votes
2answers
37 views

How-to overwrite directory on multiple places with 1 source directory

So today I encountered one of my PHP files was outdated so I've got to overwrite the phpthumb directory on the entire server. Multiple websites use this folder on multiple unknown locations, so how ...
1
vote
2answers
117 views

Moving files older than one year to parent archive directory

I want to move the photos of my collection into an "/home/Bruno/Archiv/Bilder" directory, which is parent to the "/home/Bruno/Bilder" Directory. I started of with: find -ctime +365 -exec echo mv ...
2
votes
4answers
347 views

“mv: cannot move `.' to `../general/.': Device or resource busy”

$ mv . ../general/ mv: cannot move `.' to `../general/.': Device or resource busy Does it mean that the current directory is a busy device or resource, and can't be moved away? Why is it?
0
votes
1answer
58 views

move files of a particular pattern to another directory

In the directory /home/in I have files like this: crust.MC12345.txt crust.etcMC12345.txt crust.MC23456.txt crust.etcMC23456.txt crust.etctcMC23456.txt I only need to move crust.etcMC12345.txt ...
0
votes
1answer
34 views

I have moved a zipped file to a directory which does not exist [duplicate]

I have moved a zipped file to a directory which does not exist. It resulted in creating a new file. But I am not able to open/unzip it.
4
votes
1answer
90 views

Why are execute permissions required to rename files in a directory?

Say I'm the owner of a directory and I have read and write permissions, but not execute permissions, where the directory structure is like this: x/ (drw-r--r--) y (-rw-r--r--) ...
1
vote
5answers
69 views

Rename a portion of multiple files

Take a number of files named: data_a_LT.fits data_a_LT.coo data_a_LT.ec data_a_LT.grp I want to replace all "a_LT" with "LT_A" such that I have: data_LT_A.fits data_LT_A.coo data_LT_A.ec ...
3
votes
3answers
450 views

How to integrate mv command after find command?

Given a scenario I was searching for file name which contain AAA withing it on a path using following command: find path_A -name "*AAA*" Given the output shows from the above command, I want to ...
5
votes
2answers
51 views

mv with rsync functionality

I'm trying to merge two directory trees that have many common elements but also each have elements that are only present in one of the two trees. The main issue I am having is that when mv encounters ...
-1
votes
1answer
51 views

Why doesn't rsync take advantage of the mv command when --remove-source-files is specified?

Assume I want to move a tree in the filesystem, e.g. /path/to/a a.txt b.txt to another location with rsync (3.0.9 protocol version 30), e.g. with rsync -a --remove-source-files /path/to/a/ ...
7
votes
1answer
470 views

Why does MV(1) copy objects if permission to move denied?

Does mv act as cp(1) if permission for process to move denied? If so, isn't it against the rule do one thing and do it well?
13
votes
0answers
759 views

What does “mv *” do? [duplicate]

I just gave this command by accident mv * while I was in a directory, needless to say that the content of my dir is gone and I have almost no hope to recover it, luckily it wasn't something ...
3
votes
1answer
169 views

Move preserves ownership of source files not allowing writes

Kindly Consider: $ id # Me uid=100(user1) gid=200(group1) groups=200(group1) $ ls -l tnsnames.ora # So user1 has only read permission on below file. -rw-rw-r-- 1 oracle dba 411024 Jul 28 2010 ...
1
vote
1answer
132 views

How do I force move something when sudo mv -f doesn't work?

I need to move a 16 GB folder to my external drive, but moving it manually gives me an in use error. I have tried to start in safe mode and moved it but it was still in use. I have run these commands ...
21
votes
3answers
3k views

How to rename file to .. (dot dot)?

Apparently you can rename file to .... If I were insane, how would I rename file to .. or .? Is such a filename even allowed? Backslash doesn't seem to disable dot's special meaning: $ mv test \. ...
3
votes
2answers
81 views

Move every file that is not a directory

I have a directory that I am trying to clean out that contains both files and subdirectories. What I am trying to do is simple: move all the files into another directory, but leave all the ...
2
votes
3answers
106 views

moving a (file | directory) while avoiding filename collisions

I have a bash script that moves files from a number of different locations to a folder named completed. I want to avoid overwriting previous files, so in the case when the name of a file (for ...
4
votes
2answers
130 views

(cp is to cat AS mv is to ?) mv multiple files into one file instead of cat * rm *

For everything in this question pretend the system only has one disk and filesystem. (we are not writing to different partitions, disks or filesystems) I am working on a project that cats very large ...
6
votes
4answers
1k views

“mv” command— file vanished into non-directory [closed]

I was attempting to utilize the mv command to move a file onto a remote server. I ended up executing the command... mv sqlreport.php myuser@mywebsite.org Unfortunately, this did not work. Worse, my ...
27
votes
5answers
3k views

Quickest way to rename files, without retyping directory path

I know how to rename files in Unix: $ mv ~/folder/subfolder/file.txt ~/folder/subfolder/file.sh ^------this part-------^ ^------this part-------^ I think it takes too long time to repeat ...
1
vote
1answer
50 views

With mv, possible to put a time dependence on files mv'ed?

Let's say there's a specific time and date I have in mind. All files last edited before this date I want to keep in the directory but all files that have been edited since this date I want to mv ...
3
votes
2answers
3k views

How to move a file without preserving permissions

The problem is I want to be able to see errors when moving a file, but not see errors with permissions problem. In other words - I care if the file is not fully transmitted, but don't want to see ...
0
votes
1answer
185 views

Missing File After MV command

I typed a command to refactor my file from the current folder I was in to another folder. What I wanted was: mv /var/backup /var/www/backup However, I typed: mv /var/backup /var/www/ Now I can't ...
4
votes
2answers
5k views

Solving “mv: Argument list too long”?

I have a folder with more than a million files that needs sorting, but I cant really do anything because mv outputs this message all the time -bash: /bin/mv: Argument list too long I'm using this ...
41
votes
6answers
39k views

How do you move all files (including hidden) in a directory to another?

How do I move all files in a directory (including the hidden ones) to another directory? For example, if I have a folder "Foo" with the files ".hidden" and "notHidden" inside, how do I move both ...
46
votes
6answers
19k views

How can I move files and view the progress (e.g. with a progress bar)?

When moving large directories using mv, is there a way to view the progress (%)? The cp command on gentoo had a -g switch that showed the progress.