Questions tagged [mv]

mv is the Unix command to rename or move a file or directory.

mv is the Unix command to rename or move a file or directory.

Syntax:

mv - move (rename) files

Examples:

mv /my/dir /my/other/dir

References:

Related commands

625 questions
5
votes
1 answer

Removing part of a filename with mv

How would I rename all -m.css files to .css with the shell utility mv?
fread2281
  • 1,136
  • 1
  • 11
  • 31
5
votes
1 answer

Mercurial hg mv doesn't move all files

Probably an easy one but I haven't dug up anything with the usual search queries so I thought I'd ask here. Basically I'm trying to rearrange my repo; for example: mkdir test hg mv DirectoryOfStuff test/ Mercurial moves most of the contents but it…
PeterM
  • 2,534
  • 6
  • 31
  • 38
5
votes
3 answers

git: mv command

i've read that the mv command is basically the same as $ mv README.txt README $ git rm README.txt $ git add README just to be sure, is it exactly the same if i do it this way: $ git rm --cached README.txt # [rename file using right click rename] $…
Pacerier
  • 86,231
  • 106
  • 366
  • 634
5
votes
1 answer

Replace a folder with another folder using mv (without deleting target folder first)

I am trying to get a directory to replace an existing folder but can't get it done with mv - I believe there's a way and I just don't know it (yet). Even after consulting the man page and searching the web. If /path/to/ only contains directory, the…
fabianegli
  • 2,056
  • 1
  • 18
  • 35
5
votes
1 answer

How to emulate cp and mv --parent on osx

Osx mv and cp does not have the --parents option, so how does one emulate it ? I.e. mv x/y/a.txt s/x/y/a.txt when s is empty gives a no directory found error unless one does a mkdir first which is rather cumbersome when trying to do this did…
Max Rydahl Andersen
  • 3,630
  • 2
  • 23
  • 28
5
votes
2 answers

Removing gulp.src files after gulp.dest?

I have a scenario where a client of mine wants to drop LESS files into a src directory (via FTP), and for them to be automatically outputted as CSS to a build directory. For each LESS file, once its resultant CSS file is created, it should be…
XåpplI'-I0llwlg'I -
  • 21,649
  • 28
  • 102
  • 151
5
votes
4 answers

Remove a list of words from filename

I am trying to remove a list of specific words from all my files with a certain directory and replace them with nothing. So: This Awesome Content 720p BLAH FOO BANG OOO - 30.9.2013.mp4 Becomes: This Awesome Content - 30.9.2013.mp4 Now the…
Keelan
  • 325
  • 1
  • 4
  • 12
5
votes
1 answer

Bash script/command to bulk remove "@2x" from filename (retina image -> normal)

How do I rename a bulk of files in a bash command or script, to remove iOS's retina indicator (@2x)? I've already resized them, but the resize software isn't smart on renaming the output file.
Kof
  • 23,893
  • 9
  • 56
  • 81
5
votes
2 answers

Moving large number of large files in git repository

My repository has large number of large files. They are mostly data (text). Sometimes, I need to move these files to another location due to refactoring or packaging. I use git mv command to "rename" the path of the files, but it seems inefficient…
nzer0
  • 315
  • 2
  • 10
5
votes
4 answers

How to use mv command to rename multiple files in unix?

I am trying to rename multiple files with extension xyz[n] to extension xyz example : mv *.xyz[1] to *.xyz but the error is coming as - " *.xyz No such file or directory"
Learner
  • 1,544
  • 8
  • 29
  • 55
4
votes
3 answers

Alternative for AWK use

I'd love to have a more elegant solution for a mass rename of files, as shown below. Files were of format DEV_XYZ_TIMESTAMP.dat and we needed them as T-XYZ-TIMESTAMP.dat. In the end, I copied them all (to be on the same side) into renamed folder: ls…
hummingBird
  • 2,495
  • 3
  • 23
  • 43
4
votes
2 answers

find -exec mv tells me No such file or directory

if I run: mkdir -p "$HOME"/old_foo && find "$HOME" -type d -name "*foo" -exec mv -vi {} "$HOME"/new_foo \; I get: /Users/medialab/old_foo -> /Users/medialab/new_foo but also: find: /Users/medialab/old_foo: No such file or directory why is find…
Bleakley
  • 653
  • 2
  • 9
  • 19
4
votes
2 answers

shell script mv is throwing unhelpful error "No such file or directory" even though i see it

I need to use a shell script to move all files in a directory into another directory. I manually did this without a problem and now scripting it is giving me an error on the mv command. Inside the directory I want to move files out of are 2…
Rob Nordberg
  • 55
  • 1
  • 3
  • 6
4
votes
1 answer

Why does the output from my script say "mv: command not found" but not when I run it on the shell directly?

I wrote a small script that should rename some files in a directory for me. #!/bin/bash a=1 for i in *.jpg ; do new=$(printf "%04d.jpg" "$a") mv "$i" "$new" let a=a+1 done #end of file After running the script is says…
Simona
  • 63
  • 1
  • 1
  • 4
4
votes
1 answer

Bash: passing a variable to mv command option

--Bash 4.1.17 (running with Cygwin) Hello, I am trying to pass the date into the --suffix option on the move (mv) command. I am able to pass in a simple string (like my name) but unable to pass in the date. If you run the script below you will see…
carl_corder
  • 143
  • 3
  • 12