Renaming a file with spaces


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Renaming a file with spaces
# 1  
Old 06-21-2007
Renaming a file with spaces

Hello,

So I wrote down the lyrics to a new song I'm working on in notepad (Windows) before I forgot them, then wanted to upload it to my website.

In cygwin, I copied it to my lyrics folder. The original filename was Queen of my Castle.txt but obviously in cygwin I just copied it as queeno~1.txt due to the 8 character limit.

Anyway, it was uploaded to the web server still in it's 8 character format, but now I want to rename it to the full name. How do I do that? I thought of using the %20 code for spaces, but I don't want them to appear in print as part of the filename. I can't use normal spaces as cygwin thinks it's multiple files (of course).

Thanks.

H.
# 2  
Old 06-21-2007
Code:
mv "mysong~1.txt" "my song with spaces.txt"

# 3  
Old 06-21-2007
Thanks. Quotes for strings, I should have remembered that from programming!

H.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Renaming files with Spaces in Filenames

Entry level scripter. Any help appreciated. for file in *; do rename '4321_' '' $file ; done Doesn't work for files with spaces in between FOr eg 4321_1004.dat is renamed to 1004.dat but 4321_1004 2008.dat stays the same (1 Reply)
Discussion started by: davnavin
1 Replies

2. Shell Programming and Scripting

Renaming the file

Hi guys, I have written a code to move my file from one directory to another directory, the file is in .csv format and i need to append a current date to the file. the prolem is date is getting appended after the file extension.. here is my code : cd /data/home/abc/xyz now=$(date... (7 Replies)
Discussion started by: azherkn3
7 Replies

3. Shell Programming and Scripting

Renaming file and check for the renamed file existence

Hi Am trying to move a file from one name to another When I do "ls" to check for the moved filename I can see the file but when I try the same with a script am unable.. I think am doing some pretty silly error.. please help.. toMove=`ls | grep -E "partition.+"` mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

4. UNIX for Dummies Questions & Answers

Renaming File

Hi there, I have 350 files in this directory: /home/adams/29 that was mistakenly renamed in this format: TTFILE_BIT_638478.txt.dat I want to take out the trailing .dat so that it ends in .txt: TTFILE_BIT_638478.txt I need help please. Thank you. (6 Replies)
Discussion started by: Creems
6 Replies

5. UNIX for Dummies Questions & Answers

renaming a file

Hi I remember i have create a file "Dechistory" before a month. But i dont remember exact location. I know i need to find out first that fiiles exact location for renaming it .......but i waant to that without going on that location.......how to do that ??? (1 Reply)
Discussion started by: tusharjoshi
1 Replies

6. Shell Programming and Scripting

File renaming from list of names contained in another file

I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile). The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies

7. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

8. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

9. Shell Programming and Scripting

Renaming a file

Hai masters, Suppose i have so many files named xxxx.ksh.tar, yyyy.ksh.tar and so on. My requirement : i want to rename all the files with extension ".ksh.tar" to ".tar" in my directory. Could you please tell me the solution for this.. (5 Replies)
Discussion started by: ecearund
5 Replies

10. Shell Programming and Scripting

Renaming a file name

I have an audit log that is produced each day from a production printer. It names the file using todays date, but it removes the leading zero's. For example: todays date 060104 names the file 6104.txt. I ftp this file onto a Sun box and pull stats off of it. To keep some consistency to what I am... (2 Replies)
Discussion started by: dbrundrett
2 Replies
Login or Register to Ask a Question