Questions tagged [mv]

mv is a move/rename file in Linux

mv is a tool to move/rename files/folders under *nix.

Command manual.

56 questions
46
votes
10 answers

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 either in csv or any other text format. What I…
Jestep
  • 633
  • 1
  • 6
  • 11
34
votes
2 answers

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 already exists so that pic1.jpeg becomes something…
theduke
  • 600
  • 2
  • 6
  • 11
20
votes
7 answers

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 that would allow me to do a shorthand version of…
santiago arizti
  • 405
  • 5
  • 16
15
votes
1 answer

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 good old fashioned: mv * destination Shouldn't this…
Ryan
  • 282
  • 2
  • 11
14
votes
6 answers

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 recursively up one level. Let's say I have folder foo,…
deadprogrammer
  • 1,661
  • 7
  • 24
  • 25
9
votes
3 answers

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.
MR2Power
  • 93
  • 1
  • 5
4
votes
1 answer

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 (nfs shows as 777 but I'm not sure I believe…
Jacob Tomlinson
  • 353
  • 2
  • 4
  • 15
4
votes
5 answers

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 stopped working. How shall I rename by libc.a back.…
4
votes
2 answers

What's faster for copying files from one drive to another?

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?
T. Brian Jones
  • 887
  • 3
  • 17
  • 29
3
votes
6 answers

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 of homedir one directory up for each user? Thanks for…
Sander
  • 31
  • 3
3
votes
1 answer

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 is the right command to do so?
gilzero
  • 439
  • 4
  • 8
  • 20
3
votes
1 answer

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 subdirectory of itself" eg. I…
gbjbaanb
  • 3,852
  • 1
  • 22
  • 27
2
votes
0 answers

'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 new Image I want to boot with from a…
sdepot
  • 21
  • 1
2
votes
2 answers

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 destination, for example:…
Greg
  • 1,557
  • 5
  • 24
  • 35
2
votes
1 answer

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 possible. Does the file system ensure that the…
user1011471
  • 179
  • 1
  • 8
1
2 3 4