Google Answers Logo
View Question
 
Q: Online filename manipulation ( No Answer,   12 Comments )
Question  
Subject: Online filename manipulation
Category: Computers > Internet
Asked by: dancalio-ga
List Price: $5.00
Posted: 15 Feb 2005 05:29 PST
Expires: 19 Feb 2005 04:36 PST
Question ID: 474847
I have over 1,000 image files in an online directory.  Most of them
have a space in their filename and this is causing problems with some
web applications I'm trying to use (e.g. oscommerce).  I need an
efficient way I can rename these files to take the spaces out.  For
example, right now one of the files has a name "set5 007.jpg".  I
would need this to be "set5007.jpg".  This must be done with the
actual files online as I can't simply download and upload everything.

Thanks.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Online filename manipulation
From: sqylogin-ga on 15 Feb 2005 06:25 PST
 
It really looks like you're going to have to manually rename them via
FTP...  OR, download, rename, and re-upload.
Subject: Re: Online filename manipulation
From: dancalio-ga on 15 Feb 2005 07:16 PST
 
Thanks for the input.

I hope that is not the only solution.  If there was just a sort of
"find and replace" function I could finish the job in half an hour.

It's not really possible for me to download and then upload all of
these pictures since there's several hundred mb's and I have a pretty
mediocre adsl connection (in Bangkok).

If it helps, I have cuteftp and putty.
Subject: Re: Online filename manipulation
From: james_l_mar-ga on 15 Feb 2005 13:14 PST
 
Here's a solution that shouldn't take too long.  Just a warning...the
method is a little sloppy, but it'll get the job done.  And you'll
need Excel (or some other spreadsheet program.)

1. Open Excel.  In cell A2, type in rename.  Copy this to line 2000
(go further if you have more files in the directory).
2. For a given directory, do a file listing.
3. Paste the file listing in starting in cell B2 of the spreadsheet.
4. Highlight A1:B1.
5. Under the Data Menu, select filter, then auto filter.
6. Click the pulldown for the B column.  Select Custom.
7. Click the first pulldown and pick contains.
8. In the pulldown to the right of it, type in one space (hit spacebar once).
9. Type the following in cell C2: 

=CONCATENATE(A3," ",SUBSTITUTE(B3," ",""))

Pay attention to the spaces.  And then copy this down until all the
files with spaces have the command written out.

10. Copy all the rename commands.
11. Test paste into notepad.
11. FTP in to your server using the windows ftp program.
12. Paste into your ftp window.

An alternative is to telnet in and do a "move" instead of a "rename".

A side note...the space char is represented as %20 in IE...perhaps you
could use this fact instead of renaming everything.
Subject: Re: Online filename manipulation
From: tviren-ga on 15 Feb 2005 15:31 PST
 
I just check in my "CUTE FTP" and I was able to rename remote files
without downloading and uploading, the same way you would in Windows
Explorer.  It is not a fast as the spreedsheet Idea, but he lost me
half way through!!
Subject: Re: Online filename manipulation
From: dancalio-ga on 15 Feb 2005 18:50 PST
 
I appreciate the help James.  But it seems like your system would
require having all the files on my computer first and then uploading
them to the internet.  Since I'm dealing with over 500 mb of photos on
my adsl connection I don't think that's really a possibility.  I was
hoping somebody would know something like a "find and replace"
function available through cuteftp or telnet.

tviren: I too can rename one file at a time, but I don't want to do
that with over a thousand files.. . unless I have no choice.
Subject: Re: Online filename manipulation
From: dancalio-ga on 16 Feb 2005 00:28 PST
 
Well, I'm trying this again.  Whoever helps me eventually complete
this task will definitely get the $5.

Now I think that downloading and uploading is an option since the
total files come out to only about 60 mb. If that makes this task
easier than let me know, I don't know what to do with these files once
they're here.

james_l_mar, I was a bit confused at first, but now I think I get the
gist of what you're saying to do.  There would be a giant text command
at some prompt saying rename picture 023.jpg picture023.jpg for each
of the files I have?  You would have to give me some more
clarification. On step 2, where would I do the file listing?

I have found out that if I select many files in cuteftp and click on
"rename", it will prompt me to rename each one of them individually
until each has been renamed.  This wouldn't be so terrible to have to
do and would be faster than having to do it in windows explorer with
right click, rename, for each of them.
Subject: Re: Online filename manipulation
From: james_l_mar-ga on 16 Feb 2005 14:12 PST
 
Yes.  It is a crude way of creating a script to rename all the files. 
I am certain that there's a way to write a unix script to do it, but I
don't know unix.  :(

As for step 2:  You do the file listing when you telnet (use the
windows telnet) or ftp (not cute ftp...but windows ftp) in...

for ftp: do an "ls" command (without quotes [and it's an L, not a one])
for telnet: do an "ls -l" command (without quotes [and they are Ls, not ones])

This is like doing a dir in dos or a command prompt in windows.

In the windows telnet, you should be able to highlight blocks instead
of entire lines (cuz you just want the file names and not any of the
other garbage).

If you do decide to download the files, it would be the same procedure
to rename them.  You'd just paste the rename script in a command
window in windows instead of a telnet or ftp session.

And one more thing...to rename stuff in windows explorer (files,
directories), you can simply press F2 (modify the file name, hit
return, then the down arrow to get to the next file).  Not much time
savings compared to right click (and still slower than your cuteftp
method [you could also use the rarely used menu key next to the right
control button {or shift+F10} and hit m for renaming])...but just a
bit of trivia.  And for some more unsolicited trivia F2 also will edit
the current cell in Excel (quicker than double clicking or clicking in
the formula bar).  Ok...enough of my babbling.

Hope you get it to work eventually.  Ask more questions if you don't
understand anything else I've mentioned.
Subject: Re: Online filename manipulation
From: james_l_mar-ga on 16 Feb 2005 14:30 PST
 
Here are some tools to use if you d/l all the files to your comp. 
With only 60 megs to D/L, you might as well do it this way cuz it's a
bit simpler (even though I think my renaming method can be much faster
if you don't stumble on anything).  I haven't tried any of these
pieces of software, so I'll leave it up to you to decide what's best.

google search criteria: batch rename remove space

http://www.cerebralsynergy.com/download.php?view.55
http://www.gold-software.com/download6043.html
http://www.skyjuicesoftware.com/software/qfr_info.html

And if you're really bold, someone wrote a perl script to rename
stuff.  I know pretty much nothing about perl or even how to use this
script...but here goes:

google search criteria: script rename "remove spaces"

http://www.pigstye.net/article.php/20021122075650404

HTH
Subject: Re: Online filename manipulation
From: dancalio-ga on 17 Feb 2005 02:45 PST
 
Hi James.

There's a catch when I do a listing of the files in telnet.  The
screen will only show 100 or so lines, so I can't get all of the files
all in one place.  This happened in both windows telnet and cuteftp. 
I tried dir /P and it wouldn't work.  I'm probably just doing it
wrong.

I'm gonna try one of those batch rename programs you have there.  I'll
let you know how it goes.
Subject: Re: Online filename manipulation
From: james_l_mar-ga on 17 Feb 2005 08:03 PST
 
forgot you had so many files...

still, if you have a large screen buffer, it shouldn't matter, and you
should be able to highlight and copy the list of files...

another method...

use the ">" option to direct the output to a file.

ls -l > filelist.txt

or

dir > filelist.txt

you'll then need to separate the filenames out from the other garbage
though.  you can use the excel to this too.
Subject: Re: Online filename manipulation
From: dancalio-ga on 17 Feb 2005 19:06 PST
 
Well, problem solved.  Thanks for the help James.  

I downloaded them to my computer and used the "Batch Renamer 2-51"
program you had recommended.  The program worked like a charm.

I then just uploaded the pictures back to my website all day long. 
Now I have lots of no-space pictures.
http://www.dans-jewelers.com/images/firstnewset1015.jpg

You could go ahead and claim the $5 if you like.

All the best,
Daniel
Subject: Re: Online filename manipulation
From: james_l_mar-ga on 18 Feb 2005 08:12 PST
 
You're welcome for the help.  I'm glad you got it to work in the end.

As a non-google answerer, I am not able to formally answer questions. 
I can just provide free "comments."  That's ok...google apparently
doesn't need more money from the commission for the answers I steal
from the official google answerers.  :)

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy