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 move/rename file in Linux

1
vote
0answers
51 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
0answers
40 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 ...
19
votes
7answers
2k 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
2answers
945 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
1answer
119 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
1answer
582 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 ...
3
votes
1answer
1k 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
1answer
30 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
0answers
46 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
1answer
168 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
1answer
33 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
0answers
49 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
1answer
645 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
1answer
547 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,...
6
votes
3answers
2k 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
2answers
47 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
1answer
624 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
2answers
30 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?
12
votes
1answer
3k 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
1answer
179 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
1answer
219 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
1answer
958 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
1answer
529 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
1answer
246 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
4answers
3k 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
1answer
41 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
1answer
319 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
1answer
3k 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
3answers
136 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
2answers
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
6answers
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
2answers
148 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
1answer
9k 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
5answers
489 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
2answers
82 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?
2
votes
2answers
13k 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
2answers
1k 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
2answers
245 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
3answers
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 ...
25
votes
1answer
17k 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
2answers
6k 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/...
0
votes
1answer
2k views

Cannot move folder to a subdirectoy of itself - What's going on?

O.K I am trying to do the following very simple command and it is failing as follows... mv '/home/admin/Downloads/folder1' '/home/admin/MyLibrary/MyVideos/TV/folder1/' mv: cannot move `/home/admin/...
33
votes
10answers
105k views

Linux (mv or cp) specific files from a text list of files?

I have a directory of many files, something like 50,000 pdf's and other files on a server. I need to move specific ones to another directory. I can generate a list of the files that need to be moved ...
1
vote
3answers
3k views

mass mv using find?

there are a bunch of filename.gif scattered in /home/ directories. I want all the filename.gif replaced by a /home/shared/filename_default.gif. I tried something like find /home/ -name "filename.gif"...
0
votes
3answers
381 views

linux mv command weirdness

can anyone tell me why when I type: mv -f ./tmp/members ./ I get: mv: cannot move `./tmp/members' to a subdirectory of itself, `./members' And moreover the correct way to move this directory? ...
3
votes
1answer
5k views

mv directory to overwrite another

I may be going bonkers here, but I'm trying to move a directory to a new location, overwriting the contents (on Linux, using bash). Everytime I try it, it responds with "mv: cannot move `./src' to a ...
14
votes
6answers
32k views

How to recursively move all files (including hidden) in a subfolder into a parent folder in *nix?

This is a bit of an embarrassing question, but I have to admit that this late in my career I still have questions about the mv command. I frequently have this problem: I need to move all files ...
0
votes
3answers
4k views

How can I recursively change the case of files and folders under bash

I have some files and folders that are all in uppercase that I want to rename to their lowercase equivalent. What would be the best way to go about doing this in bash on a Linux system? As an example ...