Questions tagged [mv]

mv is a UNIX command to move a file to another directory or rename it.

Filter by
Sorted by
Tagged with
0
votes
1answer
31 views

Using MV to rename image files using a script

I am trying to rename a set of Tiff images 001, 001 x, 002 , 002 x sequentially. I am looking for the script to name image 001, 002, 003 and so on This is the script I am running. num=1 # Rename ...
0
votes
1answer
42 views

Move multiple directories at once, how?

how can I move multiple directories at once, so that my 100 or more, at one time? Here in the example from directory_1 to directory_BB The directory names consist only of digits, for example: ...
0
votes
1answer
30 views

While doing mv from one disk partition to another disk partition, my files are deleted, is there any way i can retrieve it?

I mounted /backup partition by adding another disk than ran a command in /backup1 directory which is the part of root partition which belongs to old disk. I ran this command - mv * /backup/ Now, my ...
3
votes
1answer
131 views

How does this find state actually work in moving a file up one directory?

Can someone explain how the string manipulation in this find statement actually works? My head is about to explode trying to figure it out. :-o From: UNIX shell scripting: how to recursively move ...
0
votes
2answers
174 views

Remove a word from file names on Linux

I accidentally ran exiftool -all= * on my Linux system in my Downloads folder (the command removes the EXIF metadata from all files in the current directory). Luckily, exiftool creates backup files by ...
0
votes
1answer
40 views

Move only a certain sub-directory to a new folder with shell script

I have a folder Accounts containing mail accounts, all of these folders have a folder Archive.folder. I want to move all of archive folders with a simple script to a new folder. I tried this so far: ...
0
votes
1answer
45 views

Find and rename forward slash in directory name (Linux / OmniOS)?

On a fileserver at work, we have a bunch of old directories made on macOS (that was previously on an AFP share) that has / in the name. I would like to replace / with -, but am having a hard time ...
2
votes
1answer
89 views

Where did my files go after using mv command?

All my .c source files and a Readme file were in a subdirectory called assignment2 in a directory called Assignment2. Originally, from assignment2 directory: $ ls corrupt.c decode.c encode.c fix.c ...
0
votes
1answer
15 views

mv all files with different extention to a new directory with new filename and same extention

could anyone tell my how I could make a script for moving files (filename given but all possible extentions) to another new directory with new filename but same extentions. f.e. (dir or filename ...
0
votes
0answers
40 views

Change file extension of file that don't have any in specific folders and subfolders without impacting files that already have extension

I extracted some .pst documents using readpst and I got as output loads of folders and subfolders in which,there are files without extension (the .msg one, but without the .msg at the end of the file) ...
0
votes
0answers
42 views

Lost my files while moving on AWS S3

I used the command on CLI - aws s3 mv s3://<source_directory_path> <destination_directory_path> --recursive aws s3 mv s3://<source_directory_path> s3://<...
0
votes
2answers
77 views

When moving a directory into another directory, is there a simple way to generate a failure when the target directory doesn't exist?

I had a habit of using mv directory1 directory2/ thinking that if I mistyped the name of directory2 it would fail and warn me the directory didn't exist. As it turns out, that's not the case. Is ...
0
votes
1answer
39 views

Added files and folders gone after MV run

I ran mv /folder1/folder2/folder3/ /folderA/FolderB/FolderC/. Then I added more files and folders to /folder1/folder2/folder3/ during the move. It seems all of the files I added after I started the mv ...
0
votes
4answers
133 views

Linux: moving files from different directories with same name into one while renaming them

I batch-ripped my old CDs to Track1.mp3. The problem is Each CD directory has Track1.mp3 so when I move them to /Music, they overwrite! Is there possibly a bash script or mv command to move .mp3s ...
0
votes
3answers
134 views

Keep SSH connection alive when moving large folder

Context : I have a web server (my hosting provider is OVH). I have a large folder with many files in many sub-directories (100k+ files). I need to move this directory from one place to anuther on ...
1
vote
1answer
40 views

Move a range of numbered files and change their value

I've got numbered files (DSC_0001.jpg to DSC_0065.jpg), I know how to move them with mv DSC_{0001..0065}.jpg dir. I have no idea how to move them and change the range of values. mv DSC_{0001.....
1
vote
1answer
945 views

Renaming a file with mv: “cannot move to a subdirectory of itself”

I'm trying to rename a file using the regular mv command which has worked countless times before. $ ls -l |grep "Picture 001" -rwxrwxrwx 1 rolf rolf 657711 Feb 19 21:42 Picture 001_19.jpg $ mv "...
1
vote
0answers
21 views

OSX terminal: how to move thousand of files that match a specific name pattern [duplicate]

I have some 70,000 files (basically duplicates) most of which match a name pattern like name(1).ext, name(2).ext .... name(10).ext. However among these files there are others named name (xwz).ext. ...
1
vote
2answers
266 views

mv files with multiple `.` in the file name

I have some files I receive with names like (to many to do this manually everyday): AA.B.txt WW.C.txt and I want to rename them to AA_B.txt and WW_C.txt so that existing SQL code still functions as ...
1
vote
1answer
227 views

mv deleting files at the end instead of one by one

I am moving a folder recursively between two filesystems using mv -v. It seems like deletions happen at the end (in order to make mv transactional ?). I don't have enough space to hold two copies of ...
1
vote
2answers
849 views

how to rename all files under folder with specific extension name ( recursive approach )

we want to rename all files under /home/DB_home ( recursive ) so every file under DB_home will rename with .txt extension example before change /home/DB_home/hg/ir/qemu-ga /home/DB_home/td/...
0
votes
2answers
1k views

Moving files with extension from source to destination

Hello i am trying to move all files with .hi and .o extension from a target folder /src to another folder /Obj So far i have tried: srcpath=$(pwd)"/src" ghc src/Main.hs > Logs/output....
0
votes
1answer
91 views

Linux: Move files from unknown folder to unknown parent of the same unknown folder

Got your attention with that title, didn't I? LOL. Problem: I have a lot of folders that have a folder inside them, with files inside. I want to move the 2nd level files into the 1st level and do so ...
0
votes
1answer
2k views

moving files matching a pattern that catches the directory

Consider: $ ls foo xyfooz.tex $ find . -maxdepth 1 -type f -name '*foo*' -exec mv {} foo \; $ ls ./foo* xyfooz.tex I'm trying to achieve the same sequence of instructions only with mv, not find: $ ...
1
vote
1answer
39 views

Mv all files to Dropbox

I accidentally moved all files from the directory to the Dropbox folder: mv * ~/Dropbox/ That was not my intention at all. Now, Dropbox informed me that 1200 new files were uploaded, but I can't see ...
0
votes
1answer
462 views

What is the best and safest way to move files between HDDs in linux? [closed]

I have to move 5GB of data in certain folders (containing files smaller than 1MB) from an external HDD to another (both connected with USB 3.0). What is the best/safest way to make this transfer in ...
4
votes
4answers
2k views

Move files from subdirectories into single directory and prefix original directory name

I have a directory structure like this: ./a/1.png ./a/2.png ./a/3.png ./b/1.png ./b/2.png ./b/3.png ./c/1.png ... And I want to take all the files in the subdirectories and move them to a new ...
0
votes
1answer
234 views

accidentally clobbered directory using `mv` instead of `mv -t`

I accidentally did mv file /an/important/directory instead of mv file /an/important/directory/ or mv file -t /an/important/directory, so it now looks like /an/important/directory/ is clobbered. (I ...
0
votes
1answer
1k views

Fastest way to duplicate or copy or back up a directory with TB of data (image files) in it

Hi can you suggest an very efficient and high performance option to copy files (TB of data in the form of images are present) from one disk to another. I saw options like cp, rsync etc., but would ...
0
votes
1answer
133 views

What is the behavior of mv on /?

One of our users accidentally performed mv /* ../ without root permission. After checking the effects using diff I was surprised to find that mv apparently functioned as cp when applied to the / dir. ...
0
votes
0answers
315 views

mv command failed now file missing

So i ran mv command and it failed with mv: cannot stat ‘/root/HIDDENDIR/HIDDEN-DIR/recover.php’: No such file or directory And now file is missing from original and target directory. I even tried ...
0
votes
1answer
46 views

Mass checking and renaming for illegal characters in both files and folders

I wrote a python script in which it reads a text file that contains thousands of folder directory. While executing my script, I added in du -sch to try and get an approximate total size of all these ...
1
vote
1answer
734 views

Linux - Will the CP command overwrite an open file

I would like to know if I use the CP or MV command as root to copy a file to a new directory, which already contains that file and is currently open by another user, then would the operation succeed ...
0
votes
1answer
846 views

mv command deleted source files even though the file was not fully moved

I was using mv command to move multiple files from the directory A to directory B. The file system where the directory B is located was full, so I received corresponding messages. However, files were ...
1
vote
2answers
2k views

Files location after mv command without absolute paths

I have accidentally run mv command in folder to rename files. But I have forgot to specify absolute path (I did just mv old_name new_name). Now the files are gone. Any idea where those files are? ...
1
vote
1answer
4k views

sed: cannot rename ./sed6x9apB: Operation not permitted using docker-compose with WordPress image

WordPress container fails to start when using docker-compose, where there are existing WordPress files, aborting with the following error: sed: cannot rename ./sedtpghTB: Operation not permitted ...
0
votes
1answer
208 views

Linux Bulk rename media files and directories to place parentheses around the year at the end of the filename and directory name

I have a number of home video files in different directories that have a year at the end of the directory name to indicate the year that the video was filmed. It is also at the end of the filenames ...
1
vote
1answer
65 views

Shellscript - Reading filepath from textfile for restore

I'm working on a Recycle Bin script which I can call to delete a file and restore a file. The delete currently works fine and can be called using a wildcard, filename (for current directory) or a ...
0
votes
2answers
46 views

Need MV command

I need to rename a file, but keep the extension (whatever it might be, without specifying it) For example: file_20161118.csv.ovr needs to be renamed to "file.csv.ovr". However in some instances it ...
1
vote
1answer
51 views

Move multiple nested files up until they are only 1 directory deep

I have multiple files in multiple directories some buried under subdirectories. I want to be able to move all files until they are only 1 directory deep. for example: /home/folder/subfolder/file1....
2
votes
2answers
3k views

mv command reports “X and Y are the same file”, cifs filesystem

I'm trying to get a script that will rename and move videos. Here is what I have: #!/bin/bash src="/mnt/Files_Apps/temp/" dest="/mnt/Files_Apps/TFTP root/" for file in "$src"*.*; do newfile="${...
2
votes
3answers
102 views

How to copy or move files -n levels up on OSX via shell

How can I find all files of certain type/name and copy them -n levels up? Here is the filesystem tree structure: germany/ | adventure/ | 300x600/ ...
0
votes
0answers
98 views

Is mv faster with --no-clobber?

I am about to move a lot of data from one place to another for a second time, because the first time I had no access to some subdirectories and files. I am not sure wheter the -n/--no-clobber argument ...
3
votes
1answer
1k views

Bash move and rename by parsing the output of find

I have nested directories of pdf files and I would like to extract them to a higher level directory renaming them as follows: My files are something like: ./path1/pathA/fileI.pdf ./path1/pathB/...
0
votes
4answers
4k views

How to batch rename files by removing special character without using rename in linux shell

For example, I have 100 files and their names all have blank space. One of them is "The Monkey King Return (2015).mkv". How to remove all blank in name and replace with dot character, also remove "("...
0
votes
1answer
115 views

Rename php.ini.default to the more recognizable and standardized php.ini

When I type command: mv /etc/php.ini.default /etc/php.ini I get: bash-3.2# mv /etc/php.ini.default /etc/php.ini mv: /etc/php.ini....
2
votes
1answer
2k views

Cannot move ./test to a subdirectory of itself, './test/test'

When trying to convert some files to lower case I noticed something which seems strange to me. When executing this in bash: find . -iname 'test' | while IFS='\n' read item; do mv $item $(echo $item |...
1
vote
1answer
96 views

Find files with string

How can i grep e move pdf files that containing the string "RELAÇÃO DOS TRABALHADORES" inside? Using ubuntu 14.4. I already try to use: grep -i -Z -r -l 'RELAÇÃO DOS TRABALHADORES' . | xargs -I{} mv ...
0
votes
1answer
62 views

How to use mv command to remove unwanted character from multiple files in the same directory

I have in a directory some files: agent_datad.bin _codecs_cn.cpython-34m.so _Crypto.Cipher._ARC4.so Crypto.Hash._RIPEMD160.so ... other files How can I remove the _ from the beginning of each file ...
1
vote
1answer
54 views

files dissapear when I run mv command

I use the below command to move files: mv *.gz directoryname but directory name has spell mistake and the file with directory name has been generated with unknown format. And I lost my file. How ...