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: Code: #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
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 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
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. Example: I need this randall , dean, 11111 , 1309 Hillside Ave., Warsaw, VA , 23591 [code]....
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: Input: 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
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. Example: directories parent -sub1 -sub2 -sub3 files I want (the files are all the same format, but some have extensions and others dont) 1100 1215 1322 1442 1500 1512 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). [Code]...
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@192.1.1.1: /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: beach---------20090808-110000.ogg beach---------20090808-120000.ogg It's like this: name----------YYYYMMDD-hhmmss.ogg Now Im splitting these hourly files into 1 minute files. I get then this output sofar properly: beach---------20090808-110000_00.mp3 beach---------20090808-110000_01.mp3 beach---------20090808-110000_02.mp3 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: beach---------20090808-110000.mp3 beach---------20090808-110100.mp3 beach---------20090808-110200.mp3 beach---------20090808-110300.mp3
Posted: 12-01-2009, 04:51 AM
View 4 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 Code: File not found: '"test' Below is the bash script I wrote Code: #!/bin/bash # 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 done exec 10>&- files.lst contains only a single line (no newline) with Code: 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
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 :: 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
|