Linked Questions
19 questions linked to/from How to replace spaces in file names using a bash script
1
vote
3
answers
7k
views
How can I mass rename files in Linux containing spaces? [duplicate]
I want to rename all of the pdf files that contains spaces by replacing them by underscores.
So I invoke the command:
ls *.pdf | sed -e 'p; s/" "/_/' | xargs -n2 mv
and I got errors on the terminal:
...
0
votes
1
answer
357
views
Eliminate spaces in filename and rename (cywgin) [duplicate]
I use cygwin on top of windows.
I have a windows file that contains files with spaces. I want to get rid of the spaces between the characters and rename the files.
IMG_4089 - Copy - Copy.JPG
IMG_4089 ...
0
votes
2
answers
46
views
In bash, is there a better solution for iterating through a directory and modifying a single character in some folders? [duplicate]
On Bash, I used the following script to replace the empty spaces in some directories with an underscore:
for dir in */; do
mv "${dir}" "${dir// /_}"
done
This did the trick but ...
1
vote
0
answers
61
views
rename files with one single command [duplicate]
I want to rename all files ( could be also one file ) under dir directory so each file under dir will added with the name “old_” before each file
Remark – I can do the rename with loop and mv each ...
15
votes
7
answers
16k
views
How can I make the "find" Command on OS X default to the current directory?
I am a heavy command line user and use the find command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this:
$ find -name \*.plist
...
6
votes
1
answer
18k
views
mv a file that contains spaces from a shell script
I am trying to mv a file (rename it to replace spaces with dashes). If I pass the source and dest arguments without quotes, the source is broken up because mv thinks it is the end of the argument.
...
3
votes
3
answers
12k
views
git clone succeeded, but checkout failed; due to folders having leading or trailing spaces
I usually commit to a project from a macOS, and I didn't notice that leading and trailing space were embedded accidentally in folder names, but lately I tried to clone the repo from Windows,
I get ...
1
vote
3
answers
2k
views
Remove space before filename and folders recursively
I'm currently moving content from an old xServe to a Synology NAS and the client decided 10 years ago to add one or more spaces before filenames and folders to make them appear higher up in the tree.
...
2
votes
2
answers
1k
views
Using Bash to replace DOTS or characters in DIRECTORY / SUBDIRECTORY names
I have searched looking for the right solution. I have found some close examples.Bash script to replace spaces in file names
But what I'm looking for is how to replace multiple .dots in current ...
2
votes
4
answers
774
views
Replace multiple underscores in filename using bash script
Doing some reading here and here I found this solution to replace two underscores in filenames with only one using bash:
for file in *; do
f=${file//__/_}
echo $f
done;
However how do I most ...
1
vote
1
answer
1k
views
Using Perl-based rename command with find in Bash
I just stumbled upon Perl today while playing around with Bash scripting. When I tried to remove blank spaces in multiple file names, I found this post, which helped me a lot.
After a lot of ...
1
vote
2
answers
1k
views
Using command Output (with spaces) as other command Input (BASH)
Any one know why this works?
cat `echo "FilenameWithoutSpaces.txt"` # shows file content
stdout:
SHOW FILE CONTENT
And this not?
cat `echo "Filename\ With\ Spaces.txt"` # trying ...
0
votes
2
answers
260
views
Convert list of jpegs to pdf in bash
I want to convert a bunch of jpeg files to one pdf file. The files are in a numbered format:
gls -v 2014-2015-2016_R_TR-4_all_170213*.jpeg
gives:
'2014-2015-2016_R_TR-4_all_170213 1.jpeg'
'2014-...
0
votes
3
answers
71
views
Can someone please explain this working Bash code?
Naidim answered this question:
How to replace spaces in file names using a bash script
This was the only answer I could get to work for me, but I don't understand what I am looking at.
for f in *\ *...
1
vote
2
answers
143
views
Imgopt can't optimize file with whitespace in the name
Hy,
I'm trying to optimize the uploaded pictures on my webserver, with imgopt. The problem is that, when it finds a file with whitespace in the name, it throw error like that:
$imgopt file - name....