625 questions
0
votes
1
answer
45
views
adb shell mv Error [filename] not directory
I have encountered the following error when trying to rename a file on an android phone using adb on Windows. The mv command often gives me the following error:
mv: '/storage/emulated/0/Download/xrn/...
0
votes
3
answers
110
views
Rename multiple files in nested directories
I have a bunch of files with the keyword 'A' in them. They are nested to look something like this (simplified)
.
└── key_A
├── data_A
│ ├── d0_A.txt
│ └── d1_A.txt
├── image_A.txt
...
0
votes
1
answer
666
views
'mv' is not recognized as an internal or external command
Why does this code work, only when I replace the mv with move?
forfiless /c "cmd /c mv @FILE @FNAME_changed.@EXT"
Generally the short form mv works just well, but when I use it with the ...
0
votes
1
answer
269
views
Linux: Unzip archive and rename contents to archive name followed by an incrementing number
I have several hundred .zip files sitting in a directory named /zip. All of the .zip files have a unique naming convention. For example: 123456_123456.zip
What I am trying to accomplish via command ...
0
votes
1
answer
161
views
How to save an ls of my desktop onto a folder on my desktop as a txt file? In one line/step [closed]
i was doing something thinking and wanted to understand if i could save information on to folder.
I know i can do it in many steps, create the file, then move it to a folder. But is there a one step ...
0
votes
1
answer
55
views
mv command Increment a numeric char at the start of folders names that start with >1
On Ubuntu. the following command needs to change the names of the folders from "n something" to "n+1 something" where n is a number that is bigger than 1.
Below is command (by ...
8
votes
3
answers
74k
views
Linux command to move a directory into another directory
I have a directory dir1 and it contains a lot of files and directories and also I have another directory dir2 and it is empty. And I need a linux command to move the dir1 with all the files and ...
2
votes
1
answer
65
views
How to capture and modify digits recognized by regex in bash
Basically, I'm trying to increment each digit in _XtoX of each file below by 20
err_5JUP_N2_UUCCGU_1to2 err_5JUP_N2_UUCCGU_3to4 err_5JUP_N2_UUCCGU_5to6 err_5JUP_N2_UUCCGU_7to8 ...
0
votes
2
answers
141
views
ls and mv problem. File could be listed but when trying to move system says no such file
File could be listed using ls but when trying to move using mv the system says no such file.
I typed
~$ sudo mv "$(ls -lt /media/cache | grep ^- | head -1 | awk '{ print $9 }')" /media/...
0
votes
4
answers
450
views
Unix command to move multiple files at once to a target directory using parameterized filename?
I am trying to move specific file names all at once from one directory to other using single command line. I have captured the file names (not with full path) in a variable as shown below, it may have ...
0
votes
2
answers
806
views
How to insert an underscore into a file name - UNIX
I'm using HP UX and I have 1000 files that are all 10 characters long and are all numbers.
I would like to put an underscore in the file name after the 4th number to make an 11 digit file name.
i.e ...
0
votes
0
answers
73
views
linux mv - gone wrong: created 'something' (no directory) in root directory
I'm a newbie to linux and console-working. Maybe someone can give me a short hint how to solve my problem best?
what I meant to do
I wanted to move a file from a directory a) to directory b) in my ...
1
vote
1
answer
1k
views
cp: invalid option -- 'D'
My goal is to find all .pdf files from multiple subfolder structures and then move them to another folder.
For this I have assembled the following.
find /mnt/user/Data/01_Persönliche_Dokumente/...
1
vote
2
answers
1k
views
How to move files only if file and path exists?
I have wrote a command to only mv if file exists but its failing:
[ ! -f src/java/world.java ] || mkdir -p src/examples/ && mv src/java/world.java src/examples/world.java
Is there any option ...
0
votes
1
answer
888
views
Moving all files from subfolders to main folders with duplicate file names
I've been trying to write a little script to sort image files in my Linux server.
I tried multiple solution found all over StackExchange but it never meets my requirements.
Explanation:
photo_folder ...
0
votes
1
answer
88
views
how to rename create folder with hexadecimal number based on time date
Want to create or rename my image or data folders according to time, date and with a name in hexadecimal format
date +%y%m%d
echo -n "date '+%y%m%d'/{1,2,3} "
mkdir obase=16; 'date '+%y%m%d''...
0
votes
1
answer
203
views
Removing Middle Characters From File Name in Bash
I'm new to text handling in bash and have hundreds of files with varying names:
TS_01_001_21.0.tif
TS_10_005_-21.0.tif
TS_21_010_-45.0.tif
I want to remove the middle section and the extension so the ...
0
votes
2
answers
162
views
Find a string in a filename with a constant and a regular expression in the middle and replace it
I feel like this is a lame question, but after a lot of attempts, I'm stuck. I have a large number of files like this:
S2EC1_DKDL220005480-2a-AK13554-7UDI265_HHJ2MCCX2_L8_1.fq.gz
S2EC1_DKDL220005480-...
0
votes
1
answer
3k
views
Permission denied for mv command in Git Bash for Windows
I have created two directories in desktop: solid/ and liquid/. Initially liquid/ is empty.
Directory structure:
├── liquid
├── solid
│ ├── rock.txt
│ └── water.txt
I tried to move water.txt to ...
0
votes
1
answer
124
views
Why "xargs find | xargs mv" and "xargs find -exec mv" work but produce error printouts "No such file or directory"?
I get error printouts when I use methods of (1) xargs find | xargs mv and (2) xargs find -exec mv to move files, but the moving of the files works as expected. I get no error printouts when I use (3) ...
1
vote
2
answers
616
views
Bash move files and rename it as username_filename in a different folder
There are 4 user folders user1, user2, user3 and user4.
They all have music in their folder and I need to move these .mp4, .mkv and .mp3 files into the folder /tmp/Papierkorb
Also I need to rename it ...
0
votes
1
answer
72
views
preventing errors when implementing the mv command and copying strings from argv
I implemented the move command from linux.
I did not try to prevent errors. The program would check if the source file named in argv [1] exists and can be opened, how can I do that?
I also think it's ...
0
votes
0
answers
70
views
mv: the source should consist of directories
I wrote a program that implements the mv command in linux. How can I further implement the functionality through which the source is made up of directories?
code:
#include <stdio.h>
#include <...
0
votes
2
answers
822
views
How to move all folders in a directory with mv and bash variables
I wanted to take paths to directories from files that we got from a user as parameters of function and from files extract the paths and move all files and folders in the source directory to the ...
0
votes
1
answer
717
views
Bash: move and rename files to parent directory
I have the following working code:
for f in */*/*.jpg; do rename 's#/picture#p#' "$f"; done &&
for f in */*.jpg; do rename 's#/subfolder#s#' "$f"; done
However, this does ...