Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Linux


Ubuntu :: Command To Remove Spaces From Filenames?

I have just switched to banshee as my media player and imported my films and music. Problem is, the video list is quite hard to read because all the video files have spaces in their names which are replaced by % signs, numbers and letters. I'm wondering if there is a command I can use in the directory that will automatically remove all the spaces from the filenames or better still, replace the spaces with hyphens or underscores?

View 6 Replies (Posted: August 18th, 2010)

Sponsored Links:

Related Forum Messages For Linux category:
General :: Bash Command To Remove Spaces
I am reading the output of /proc/acpi/thermal_zone/ATF0/temperature in a program to read my CPU temp. I am using cat like the following:

#cat /proc/acpi/thermal_zone/ATF0/temperature
temperature: 49 C

I basically want to get rid of the spaces in between temperature and the actual temperature. Is there a command I can pipe the cat output to, to remove the spaces. I have seen suggestions for sed, or tr, but for some reason I cannot get them to work properly.

Posted: 09-14-2010, 09:41 AM

View 14 Replies!   View Related
Ubuntu :: Remove All Foldernames Which Contains Spaces In Desktop With A Single Command?
How to remove all foldernames which contains spaces in Desktop with a single command?

Posted: June 8th, 2011

View 7 Replies!   View Related
Programming :: Unix Command To Remove White Spaces?
Im using this unix command(in a php file) to remove a certain string and then remove the whitespace left by that string. Unofrtunately in many cases, the files get completely erased. Is there a workaround?


$dir = "./";
$rmcode = `find $dir -name "*.php"


Posted: 09-18-2010, 06:36 PM

View 14 Replies!   View Related
Ubuntu :: Type Spaces In Filenames In Terminal?
I'm trying to access a file and copy it to another location, but the drive name has a space. I'd like to rename that too.

I know that a % sign is sometimes used, but this didn't seem to work in terminal...

Posted: March 18th, 2010

View 9 Replies!   View Related
Programming :: Php Scripts Cant Locate Filenames With Spaces?
I have a fresh dedicated server that im currently configuring and needed a little help if I may ask.The problem is that i'm having a file naming issue. for example from the web I can access any file that does not have spaces of any type. ex/music/musicfile.mp3this works fine and my php script can locate itBut the problem is when I try to access a file that has spaces.ex/music/The Eagles - Hotel California.mp3my php script can't seem to locate any files like this with spaces but doesn't have a problem locating the files with no spaces.

I also took a look at the directory within shell. I did notice that files that have spaces are showing up in this formatt in shell.#/home/~username/public_html/music/The Eagles - Hotel California.mp3In shell , i'm assuming that unix/linux maybe adds a backslash before spaces. But when I FTP to this same directoy, the filename look normal and at windows standard. how could I correctly access these types of files within my php scrits? or would I need to have all uploaded files renamed so that spaces are replaced with underscores maybe?

Posted: 04-13-2011, 11:17 AM

View 4 Replies!   View Related
Software :: Remove Parenthesis From Filenames Using Sed?
I have filenames like such: abc (e).doc And I want to rename them to abc.doc I have a directory full of files names like this. How can i do this using the sed command? I have looked online for about 2-3 hours now and am frustrated that I can't find an answer.

Posted: 06-08-2010, 05:57 PM

View 11 Replies!   View Related
Software :: Remove Part Of Multiple Filenames?
hey all i have a folder with lots of random jpegs but they all have the words 'SOMETHINGRANDOM' in there name that i want to remove and i'm trying something like this but it just renames all the files to 'newname'? Code: for filename in *.jpg; do newname=`echo $filename | sed -e 's/SOMETHINGRANDOM//g'` mv $filename newname; done

Posted: 01-19-2011, 01:24 AM

View 9 Replies!   View Related
Ubuntu :: Remove All Double Or More Spaces From A Group Of Words?
How could someone remove all double or more spaces from a group of words? Is there a GUI program or CLI method or both? Example: I like to turn this:


Posted: March 7th, 2010

View 2 Replies!   View Related
Programming :: Using Sed To Remove Preceding And Trailing Spaces In CSV?
the preceding and trailing spaces around the commas in my CSV without destroying my address field. I'm new to regex and sed so this is probably easy but I just can't do it without destroying the Address section. I'm using vanilla Linux and sed 4.1.3I'm willing to use any regex or even awk if needed.

I need this
randall , dean, 11111 , 1309 Hillside Ave., Warsaw, VA , 23591


Posted: 09-16-2010, 07:35 AM

View 11 Replies!   View Related
General :: Selectively Remove Blank Spaces From String?
need all spaces between two letters or a letter and a number exchanged for an underscore, but all spaces between a letter and other characters need to remain. One example for clarity:


force -- lamin 90 [label]
active A -- generation [label]

needed Output:

force -- lamin_90 [label]
active_A -- generation [label]

I tried solving this with sed but obviously s/ /_/g does not work, nor does any s/[a-zA-z0-9] [a-zA-z0-9]/[a-zA-z0-9]_[a-zA-z0-9]/g , because you just can't do this...

Posted: 10-07-2009, 01:07 PM

View 2 Replies!   View Related
General :: Remove Spaces From Many File Names Under Cygwin?
I'm hoping that someone can help me, I need to remove spaces (not replace with underscores) from several thousand files on a system with cygwin.
Can I do this from the shell using rename or mv somehow?

Posted: 11-22-2010, 04:00 AM

View 4 Replies!   View Related
Ubuntu :: Find Command For Multiple Filenames Stored In List?
I searched the forum and didn't find any threads that seemed to answer this question. I have a large directory of files, and dozens of subdirectories on a remote box I have ssh access to. I need a subset of these files copied to another folder.



files I want (the files are all the same format, but some have extensions and others dont)

Unfortunately, I need a lot of files, and plan to do this on a regular basis (the files I need will be different each time) I was thinking it would be nice to be able to put the filenames in a text file (one filename per line) and use the find command to copy the files (I don't necessarily know which subdirectory the file will be in).


Posted: May 3rd, 2011

View 2 Replies!   View Related
General :: Running SCP Command With Spaces?
I am trying to run an scp command on my linux server, this is working fine, however I changed the output folder to one which has spaces and now when run, it's coming up saying SCP ambiguous target

Here's my string:
expect -c 'spawn scp -r /var/lib/asterisk/backups/Everyday/ administrator@
/Volumes/Data1/My Backup Folder/ ; expect assword ; send "MYPASSWORD " ; interact;'

Posted: 01-21-2010, 07:19 PM

View 4 Replies!   View Related
Software :: Bash - Rename Filenames With Corresponding Filenames?
I got a filename called like this:


It's like this:


Now Im splitting these hourly files into 1 minute files. I get then this output sofar properly:

and so on....

the 00, 01, 02 and up are the minutes it has splitted it. Now I need a script, after it did this, to rename the file names into this:


Posted: 12-01-2009, 04:51 AM

View 4 Replies!   View Related
OpenSUSE :: Renaming Long Filenames - Rename Command Not Working
I misused wildcards like a moron, in the rename command. I repeated names twice in a 3gig folder, which I cannot afford to delete. Now, the rename command is not working, and it says the file name is too long. I am a competent programmer in Java, PHP, and I know basic C.

Posted: 09-Aug-2010 07:09

View 7 Replies!   View Related
General :: Spaces In Command Line Switches
I am trying to encode files via mencoder. The file name has spaces in it. "test file.mkv". When I manually type the command in the terminal, everything works. But when I use a bash script (I'm reading it from a file) it doesn't. It gives me

File not found: '"test'
Below is the bash script I wrote

# For testing, we have already built a file list, so just use that.
# ls *.mkv>files.lst
exec 10<files.lst
let count=0
while read -u 10 FILE; do
LINE="mencoder -of lavf -lavfopts format=mp4 -vf scale=1024:-3 -ovc x264 -x264encopts crf=28:vbv_maxrate=1500:nocabac:global_header:bframes=0 -oac faac -faacopts br=160:mpeg=4:object=2:raw -channels 2 -srate 48000 "$FILE" -o test.mp4"
echo $LINE
exec $LINE

exec 10>&-
files.lst contains only a single line (no newline) with
test file.mkv

On a related note, when I was first trying this simply on the command line, I had a file that had a double exclamation point. I found out that that is a shortcut of some kind for the previous command. My kludge to get around this was to try to execute a single exclamation point as a command, then to change the double exclamation point to a quadruple exclamation point. Is there a proper way (escape sequence or something) to pass double exclamation points to a command?

Posted: 10-06-2010, 04:32 PM

View 2 Replies!   View Related
Software :: MV Command With Files Name Include Spaces
One system send files to linux machine and it is name contains spaces and I tried to move it from one directory to other, but it show error:
mv -f file one file two
mv: target 'one' is not a directory

Posted: 10-03-2010, 01:45 PM

View 6 Replies!   View Related
General :: Cut And Paste Filename With Spaces Into A Command?
when i type ls or locate as an output i get "a file.txt" (there is a space between "a" and "file.txt".

i highlight it with a mouse and than paste it with a middle button.

now i have to put after "a" so that "a file.txt" can be read in a command such as "ls a file.txt" now if the file name is a name of some book that has a lot of spaces it takes time to modify the name. is there a way to do this quick?

Posted: 2 days ago

View 2 Replies!   View Related
General :: Access Files With Spaces From Command Line?
How do I access files with spaces from the command line?
for example I want to go to a file called "New File" and let's say is in Downloads/Books/(and here is the file)
how do I input the space since the command line doesn't recognize it?

Posted: 03-17-2011, 10:59 PM

View 2 Replies!   View Related
General :: Shell - Rename A File From Something Without Spaces To Something Containing Spaces?
Is it possible, in Linux, to rename a file from something without spaces to something containing spaces? I know I can create directories and files with spaces by doing:

mkdir "new dir" and:

touch "new file.txt"

I want to rename files from:

imgp0882.jpg to something like:

20091231 1243 some topic.jpg

And how would it look in a shell script that uses parameters like:

for i in *.jpg do
rename "$i" "$somepath/$mydate $mytime $mytopic$extension"

I'm new to Linux (using PCLinuxOS 2009.2), coming from Windows, and I've written myself a little shell script to download files from my camera and then automatically rename them according to a date-and-topic pattern. As you can guess by now, I'm stuck on the bit about renaming. If you want to see my script, here's a copy. I'm not using jhead for this renaming because that only works with JPEG files but I want a single solution for any media format including videos.

Posted: Jan 26 10 at 21:56

View 2 Replies!   View Related
Ubuntu :: Remove A Program By The Command ?
How to remove a program by the command

sudo make install

Posted: March 19th, 2011

View 1 Replies!   View Related
Debian :: Remove All Of Kde In One Command?
How do I remove all of kde in one command except for the kde packages that I have installed before doing apt-get install kde?

Posted: 2010-01-29 22:55

View 14 Replies!   View Related
Ubuntu Installation :: Console Command To Remove All <expression>
My console fu is a bit lacking, as it seems that I can't figure out how to uninstall all packages containing a certain expression.

I tried: apt-get remove *expression*

Posted: February 11th, 2010

View 1 Replies!   View Related
Ubuntu :: The Terminal Command For 'safely Remove Drive'
If I click right-click on a drive in nautlius and do 'safely remove drive', the external hard-drive stops spinning.

What is the terminal equivalent? If I do 'pumount' it is unmounted, but the hard-drive continues spinning.

Posted: March 6th, 2011

View 3 Replies!   View Related
Copyright 2005-08, All rights reserved