Questions tagged [mv]
mv is a move/rename file in Linux
57
questions
1
vote
1
answer
74
views
mved a lot of files to the same name - recovery possible
What exactly happens on file system level (ext4) when you mv one file over another file?
Accidentally mved quite a lot of files over one other file. I wonder if it is possible to somehow restore the &...
0
votes
1
answer
479
views
Variables on set-hostname and mv command in shell script
I have the below script in Shell:
read n
for ((i=1;i<=$n;i++))
do
echo "Connecting to $publicip"
ssh -i ./key.txt root@$publicip 'hostnamectl set-hostname autotest$i.domain.com && ...
0
votes
1
answer
2k
views
`mv` command did not rename, but move into existing directory, from ansible
I am running an ansible task (inside a role):
- name: Rename dir
become: yes
shell: mv /data/files/1.6.5 /data/files/1.7.0
The intended effect is that 1.6.5 is renamed to 1.7.0
Now, on the target ...
-1
votes
1
answer
331
views
Safest way to move a mount point that is a parent of other mount points on Linux to a new physical device
I goofed up and /var/lib/kubelet was not mounted on a server. So it was on the root. I noticed this and I want to fix it. I did the stupid thing and just tried to stop the associated services (kubelet)...
0
votes
1
answer
1k
views
Move files older than day
I am looking for some solution, where I have to move all the directories and files under the source directory to the destination a day before. I want to move the directories till yesterday but not ...
0
votes
1
answer
379
views
Bash: How to move files and directories from one directory to another?
I'm trying to write a script that moves files and (sub)directories from within one directory to another. That move operation should include not only regular files and directories but also any dot-...
0
votes
1
answer
138
views
Fired mv wordpress /* ./ while in /var/www
I don't why that happened but I was in /var/www and I fired the command
mv wordpress /* ./
And now I'm not able to access my server via ssh, rdp or teamviewer. I really gotta fix it. What should I ...
0
votes
1
answer
82
views
Why nginx give different results with files whose same file-system Permission?
Every time if I put a file into the doc dir of nginx by using the mv command, it always results in a 403 Forbidden error, but if I do that by using the cp command, no error occurs.
I tried very large ...
1
vote
1
answer
2k
views
UNIX Copy/Move files in same directory preserving timestamp
Following is the scenario. There are multiple files in a directory created by users belonging to same unix group.
Unix Group: Prod.
User in Prod Unix Group: User1 User2 User3.
All 3 users have same ...
1
vote
0
answers
437
views
The command "mv test_file TEST_FILE" fails with "mv: ‘test_file’ and ‘TEST_FILE’ are the same file" in a CIFS filesystem
I have a CIFS filesystem mounted in an Oracle Linux 7 server:
//win-server/shared-folder on /data1/shared_folder type cifs (rw,relatime,vers=1.0,cache=strict,username=winuser,domain=mydomain.com,uid=...
2
votes
0
answers
53
views
'reboot' command doesn't work properly after 'cp' command, 'mv' behaves weird, as well
I have compiled C code running as a binary on an ARM. The ARM boots Linux from an SD Card using an old Image that was generated using buildroot. Within the C code I call a shell script that moves the ...
20
votes
7
answers
4k
views
Linux mv file with long name
In Linux I sometimes rename files like this:
mv dir1/dir2/dir3/file.txt dir1/dir2/dir3/file.txt.old
Note that I want to just rename the file, not move it to another directory.
Is there a command ...
2
votes
2
answers
3k
views
How to perform the mv equivalent of yes | cp -rf on directories?
Using the below directory tree as an example, what is the best way to move the contents of directory/folderA to directory.
How to overwrite a file if a file with the same name exists in the ...
1
vote
1
answer
818
views
Recovering original filename after renaming in Ext4
If I rename a file with mv command like:
mv original_file_name new_file_name
Is this possible to recover the original filename on Linux Ext4 file system and if so how that can be done?
0
votes
1
answer
1k
views
Bash Script To Move Files While Creating Directories
I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and ...
4
votes
1
answer
4k
views
mv fails but cp succeeds on nfs mount
I am trying to move a file from a local directory to an nfs mounted directory on a CentOS 7 server. The export is provided by FreeNAS.
Both directories are owned by the current user with at least 755 ...
-1
votes
1
answer
37
views
How to check if a unix based system supports a specific option on a command (mv -T)
I'm working on a deploy script which wants to update a symlink atomically. I intend to use a command like
$ ln -s new current_tmp && mv -Tf current_tmp current
(Credit to here for details on ...
0
votes
0
answers
51
views
How to "stage" file movements before performing them on Windows?
I have a disk with terabytes of data. I would like to reorganize the disk.
The problem on Windows is that if I move one of the directories to the new place, I have to wait hours for that relocation ...
1
vote
1
answer
532
views
Unix move folders with pattern
How can I move subfolders with a pattern to the new location?
Example list of sources:
/data/aaa/_old/
/data/bbb/_old/
The destinations should be:
/archive/aaa/_old/
/archive/bbb/_old/
Is there a ...
2
votes
1
answer
41
views
mv: when is the resulting file available?
Suppose one process does this: mv a large file to a destination directory
And another process is watching for that file in the destination directory because it wants to read its contents as soon as ...
1
vote
0
answers
72
views
LMD/Maldetect: Missing target-file operand after
After running mallet 1.5 in screen-mode (# maldet -a /var/www) I'm getting this return:
maldet(6070): {scan} 618017/618044 files scanned: hits 0 cleaned/usr/bin/wc: /usr/local/maldetect/tmp/.sess....
1
vote
1
answer
808
views
Detect USB driver plugged in and run a certain file on it
I have some kind of a kiosk Ubuntu set up based on Ubuntu Server 14.0.2 which runs an application on chrome. The kiosk has no internet connection thus the updates to the application should be done ...
2
votes
1
answer
901
views
NGINX and log rotation: is missing log entries possible?
In it's simplest realization, one can implement NGINX log rotation as following:
mv access.log access.log.0
kill -USR1 `cat master.nginx.pid`
My question. Do we have a concurrency issue here? I mean,...
9
votes
3
answers
4k
views
Is mv with wildcard still atomic
My understanding is that mv dir1/file1 dir2/ is atomic,
Is mv dir1/* dir2/ also atomic?
As an example, assume there are 10 files in dir1 that are 10GB each.
1
vote
2
answers
62
views
On Debian, what command will return the file with the "smallest" filename from a directory?
I have a directory containing three files, for example, 5.war, 6.war and 7.war.
What command will return the file with the "smallest" filename from this directory? (In this case, 5.war.)
2
votes
1
answer
1k
views
CentOS - Accidentally Moved and Removed /home/ folders [closed]
I ran (stupidly) these commands:
mv ncdu/ /home/*
mv ncdu/ /var/*
Trying to move the ncdu folder into these directories. And it caused me to remove all my Apache directories in my /home/ folder, ...
0
votes
2
answers
41
views
used mv file.sql /folder instead of mv file.sql folder/
Hello I made the mistake of using mv file.sql /destinationfolder instead of mv file.sql destinationfolder/- using su root. Now I can't find my sql file. is there a way to find it/recover it?
15
votes
1
answer
5k
views
FREENAS: Why isn't mv command instant within a RAIDZ1 volume?
I'm currently 'reorganizing' file structure within a RAIDZ1 volume. Moving directories from one dataset to another, which are both contained on the same volume.
SSH'ed into the machine and did a ...
0
votes
1
answer
305
views
SSH find directories with uppercase letters [closed]
Using SSH how can I find sub-directories that begin with uppercase letters within a directory and then rename them, including merging if the lowercase named directory already exists?
e.g. if there is ...
0
votes
1
answer
354
views
Script to move Maildir contents to its parent dir but for multiple folders
I totally suck at Bash/Python/Ruby/Perl Scripting (need to practice/learn some more) so I'm asking for a little help :-)
I need to move about the contents of about 60 Maildirs to their parent folder ...
0
votes
1
answer
2k
views
Root cannot move files
I'm on Debian 5, I want to move files, but I'm getting a permission denied error, even if I'm root.
Do you have any solutions?
-rw-rw-rw- 1 scusr scusr 49901 Jun 17 09:04 ...
0
votes
1
answer
820
views
Permission denied with mv under apache
I have a bash cgi script called by apache which should move one file in /var/www/html to another in the same directory. I've set up the relevant permissions with selinux (e.g. chcon to ...
1
vote
1
answer
442
views
Remote rename of a file on Samba share via Bash script
I'm running a Bash script under Cygwin, but this question applies more broadly.
I have a remote file: //someremoteserver/somefile.db
That "//" path is under Cygwin--it's essentially a UNC pathname ...
2
votes
4
answers
4k
views
move files from one device to another
I am trying to automate a remote backup on our centOS server, I run the current command :
nice -n 10 mv -vfb /media/localbackup/* /media/remotebackup/
however when this is ran I get the following ...
0
votes
1
answer
54
views
Linux directory moved
a directory was moved with mv command in a Linux box, what logs should be looked at for such action? in root bash_history i can see the command was used, unfortunatly bash_history was not recording ...
1
vote
1
answer
709
views
Error when using mv
I am receiving an error when trying to mv some files that really doesn't make sense. I receive this error:
mv: cannot move `thatDir' to a subdirectory of itself, `/usr/local/apache-tomcat-6.0.32/...
-1
votes
1
answer
4k
views
Can't move large files, always get Input/output error after some time
I want to move a large file (hdd of a paralells vm, 81G) from one hd to another. After some time I get the error message: Input/output error. What can I do to move the file?
I checked source and ...
-1
votes
3
answers
149
views
Rename tons of files
How can I rename all the files with a pattern like this:
thumb_f318d8a580ca5717d686a323b6c2ca0d.jpg0000777
thumb_f18d8aup90ca5717d686a323b6c2c5uh.jpg0000777
thumb_jessr8d8a580ca5717d68623etrtckks....
2
votes
2
answers
2k
views
linux shell script: how to move all sub folders with a given name?
I'd like to move all sub-folders starting with a given suffix (Blah_ in the example) into an other directory using a linux bash script. Here's what the script looks like:
srcDir="/home/me/"
...
3
votes
6
answers
2k
views
How to mass move files one directory up
I have about 200 directories in /home/. The problem is that they all exist in this way:
/home/{user}/homedir/
While it should just be:
/home/{user}/
With what command can I mass move all content ...
1
vote
2
answers
156
views
Delete all files via mv date?
Everyday new audio files are created in dir1.
Sometime I move (mv) some files from dir1 to dir2
I want to delete all the files in dir2 that was moved before 20th June
Is this possible?
3
votes
1
answer
10k
views
Command: move all files inside a directory to another directory (including hidden files)?
I tried to move all files inside a directory to another directory like this:
$ mv /directory_one/* /directory
However, the hidden files (such as .htaccess) in /directory_one won't be moved.
What ...
4
votes
5
answers
569
views
How to rename libc.a back
I am working on AIX 6.1 and inadvertently renamed /usr/lib/libc.a to usr/lib/libc.a_ Just as I renamed I realized my stupid mistake. Almost all of the commands mv, cp, ftp etc ( except cd ) have ...
2
votes
2
answers
94
views
*nix behavor, when overwriting a file that's open by another process using mv
Will the other process be able to finish reading the old file even though it's been replaced?
6
votes
2
answers
26k
views
What's faster for copying files from one drive to another? [closed]
Running linux. I have two identical drives mounted on the same machine. What is faster CP, MV, or RSYNC? Why is one faster than the other? Are there any faster alternatives?
1
vote
2
answers
2k
views
used mv command and my whole filesystem is missing
Alright, so I was in /var/www/forum/newrelease
What I wanted to do was copy all of the files in newrelease to the directory forum, so I was thinking the command mv /* ../* would work, but now ...
1
vote
2
answers
280
views
File move in Perl that stops the current script?
how can I do this mv ($file $new_file/$1) or die("Errors 2");
so it would stop the script in terminal if the file is not found?
otherwise it keeps repeating and repeating and I need to restart putty ...
0
votes
3
answers
5k
views
copy and rename files
Here are my access logs those I want to backup.
/var/log/httpd/access_log
/var/log/httpd/access_log.1
/var/log/httpd/access_log.2
/var/log/httpd/access_log.3
...
I want to copy all these files but ...
34
votes
2
answers
27k
views
mv, rename if exists
I need to assemble a lot of images into one directory. Many of those images have the same file names.
Is there some safe version of mv that will automatically rename files if the target filename ...
0
votes
2
answers
16k
views
cannot move to a subdirectory of itself
I have 2 folders:
/home/sphinx/articlesdb/
and:
/home/sphinx/tmp/articlesdb/
I want to move and overwrite all of the files from tmp into the main folder.
I am currently using:
mv -f /home/sphinx/...