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
-1
votes
1 answer

How to move files containing, inside their title, strings from a txt file listing one string per line

I need to move any file containing one of several strings in their titles from one directory to another. The strings are in one file named brh.txt and are on top of each others, one per line. Here is what I have tried : for i in $(cat brh.txt); do…
george
  • 1
-1
votes
1 answer

awk renamed few files and left few to renamed

I am trying to replace part of filenames based on matching string of filename from another file. Filenames are in following format: 36872_20190806_00.csv 40800_20190806_00.csv 41883_20190806_00.csv 38064_20190806_00.csv 40848_20190806_00.csv …
Ajay
  • 320
  • 2
  • 11
-1
votes
3 answers

Linux help: how do you move files to folders based on a .txt file?

I have a .txt file containing a column of IDs and their ages (as integers). I've already created separate folders in my directory for each age category (ranging from 20-86). For every ID in my .txt file I would like to move their image (which is…
M_Oxford
  • 361
  • 4
  • 11
-1
votes
2 answers

search and rename and mv all files from directories and subdirectories

i have a lot of files 30k directories, 21k files inside direrctories and subdirerctories of txt files with the same name ├── cases__in_africa │   ├── 2020/10/01.txt │   ├── 2020/10/02.txt │   ├── 2020/10/03.txt …
ben
  • 25
  • 1
  • 10
-1
votes
2 answers

Rename all files of a certain name within all second-level sub-directories

My goal is to automate the following process: search within all second-level sub-directories, and for all files called "Test.pptx" in said sub-directories, rename to "Test - Appended.pptx". Based on responses I have seen to other questions on…
-1
votes
1 answer

moving and renaming a folder in linux

I want to ask a question about moving and renaming folders in linux simultaneously. Consider I am on my desktop and want to move a folder to another location. folder1 exists at ~/folder1 If I want to move it to the desktop, I do the following…
vik1245
  • 546
  • 2
  • 9
  • 26
-1
votes
2 answers

Batch file rename where part of the old name became directories

I don't know if this is possible using bash but it would be nice to be able to do this just using bash. I receive bunch of files (regularly) with the following name pattern: xxx___yyy___abc__def.pdf…
Pelangi
  • 401
  • 1
  • 4
  • 6
-1
votes
1 answer

Rename Linux files by removing characters after extensions

I would like to rename all .jpg files in a folder on Linux through one line in the terminal. The filenames all end with numbers ranging from one to three digits. I would like to get rid of the numbers at the end of the file…
-1
votes
2 answers

Cannot stat , No such file or directory linux

Ive looked over some other questions similar to this but none of the solutions worked for me. I've got two directories Teacher and Employee. I've got a file in the Teacher directory called Emp7.tar.gz and i want to move it into the Employee…
Feng
  • 1
  • 1
  • 2
-1
votes
1 answer

Getting permission denied error when executing a command via subprocess.Popen but not in shell

I am trying to move a folder into another folder but am getting Permission Denied error when I try to perform this operation in a Python script vs. the move working successfully when I run it in bash or even in Python interactive mode. cmd =…
Parth Shah
  • 2,060
  • 1
  • 23
  • 34
-1
votes
1 answer

rename a file with 2 lists in bash

I have 2 text files, old.txt with the list of all files needs to be rename and new.txt with the new names. For example, old.txt 23654.jpg hello world.doc ok, it's done.docx new.txt 2018.jpg old.doc ... I wanted to read line by line those files and…
A D
  • 25
  • 6
-1
votes
1 answer

Add extra file extension to all filenames in a directory via Linux command line

I want to add the ".sbd" after all files ending on ".utf8" in a directory I do not want to replace the extensions, but really want to add them so the filenames will look like "filename.utf8.sbd" I think I should adapt the following code, but don't…
-1
votes
3 answers

Linux command to move all the files from var/A to var/

I guess that this question has been asked here, but I didn't find it. I am at directory var/ and I have a folder var/A that have some files inside, what I want is to move this files inside A to var/. so what i want to do is the…
david.t_92
  • 1,971
  • 1
  • 11
  • 15
-1
votes
1 answer

How to avoid linux move error due to socket files?

I have a mv folder line that displays a confusing message because there is one socket file inside this folder. Is there a way to change it in such way that it will not display this error. I don't really care about this socket file because its…
sorin
  • 161,544
  • 178
  • 535
  • 806
-1
votes
3 answers

remove prefix and suffix from the file with mv

I have a directory which contains multiple files. I need to rename these files. This is how the file names looks like: snap-file-name-1.txt snap-file-name-2.txt snap-file-name-3.txt I need to remove "snap" and ".txt" from these…
Asdfg
  • 11,362
  • 24
  • 98
  • 175