STUPID%20FILE%20NAMES

  • Thread starter Thread starter casey.o
  • Start date Start date
C

casey.o

I saved a bunch of animated Gifs from a website. About 400 of them.
Rather than save them one by one, I just saved the entire webpage which
had about 10 to 15 per page. Then I just went to the saved page,
deleted the .htm file and the other junk, such as the scripts and
headers. What remained were just the .GIF files.

I thought this would save time, but I soon found out different. Instead
of saving the file by it's name

(EXample):

ANIMATED GIFS DOG 01.GIF

I got this:

ANIMATED%20GIFS%20DOG%2001.GIF

Why does it do this? It fills in all the blanks with %20, which seems
really senseless and is annoying as hell.
This is not the first time I've had this happen....

So, rather than save time, I now have 400 files to rename, one by
one....

Just for the heck of it, I googled for "Bulk file remaner". I did
download one program called "Bulk Rename Utility". I wasted an hour
trying to understand the program, and deleted it. It makes no sense at
all. That seems to be all that is available for this sort of use.
All the time I wasted trying to understand that program, I could have
manually renamed half the files.
 
I saved a bunch of animated Gifs from a website. About 400 of them.
Rather than save them one by one, I just saved the entire webpage which
had about 10 to 15 per page. Then I just went to the saved page,
deleted the .htm file and the other junk, such as the scripts and
headers. What remained were just the .GIF files.

I thought this would save time, but I soon found out different. Instead
of saving the file by it's name

(EXample):

ANIMATED GIFS DOG 01.GIF

I got this:

ANIMATED%20GIFS%20DOG%2001.GIF

Why does it do this? It fills in all the blanks with %20, which seems
really senseless and is annoying as hell.
This is not the first time I've had this happen....

The %20 is the hexadecimal representation of a space. For a web
address, you cannot have spaces in a file name you want to link to so it
either displays or automatically starts the download process.

"One of the most common special characters is the space. You can't type
a space in a URL directly. A space position in the character set is 20
hexadecimal. So you can use %20 in place a space when passing your
request to the server.

"http://www.example.com/new pricing.html

"This URL actually retrieves a document named new pricing.html from the
www.example.com"


http://www.tutorialspoint.com/html/html_url_encoding.htm

That's the best I can offer without knowing the URL you started from.

<snip>


--
Ken
Mac OS X 10.8.5
Firefox 25.0
Thunderbird 24.3.0
"My brain is like lightning, a quick flash
and it's gone!"
 
Spaces are not valid in URLs, so the space gets
replaced with the hex ANSI code for a space.
(H20 or decimal 32)

I'd suggest you look into VBScript and the Windows
Script Host. I use it regularly for jobs like this and
keep more than a dozen scripts on the Desktop.

Here's a sample. If you copy the text below into
Notepad and save it with .vbs extension, you can drop
a folder onto it. The script will ask you what text to
replace in file names, then it will ask you what to
replace it with. (For instance, you can enter %20 in
the first box and type a space in the second. To remove
text, leave the second box blank.)

The script will then process all files in all subfolders,
down one level, plus all files in the dropped folder. (It can
be made recursive, but this version is probably adequate
for most uses.) If you're nervous about doing this, copy
the parent folder first and process that.

' Watch out for wordwrap when you copy this.
'---------- begin vbscript---------------

Dim FSO, Arg, oFol, oFol2, oFols, oFil, oFils, s1, sRep, sRepWith

Set FSO = CreateObject("Scripting.FileSystemObject")
Arg = WScript.Arguments(0)

If Len(Arg) = 0 Then
MsgBox "Drop a folder onto this script.", 64
DropIt
End If

sRep = InputBox("Enter text to replace in file names.", "File Renaming",
"%20")
If Len(sRep) = 0 Then DropIt

sRepWith = InputBox("Enter replacement text.", "File Renaming", "")
If Len(sRepWith) = 0 Then sRepWith = ""

On Error Resume Next

Set oFol = FSO.GetFolder(Arg)
Set oFols = oFol.SubFolders
For Each oFol2 in oFols
Set oFils = oFol2.files
For Each oFil in oFils
s1 = oFil.name
s1 = Replace(s1, sRep, sRepWith)
oFil.name = s1
Next
Set oFils = Nothing
Next
Set oFols = Nothing
Set oFils = oFol.files
For Each oFil in oFils
s1 = oFil.name
s1 = Replace(s1, sRep, sRepWith)
oFil.name = s1
Next
Set oFils = Nothing
Set oFol = Nothing

DropIt

Sub DropIt()
MsgBox "Done."
Set FSO = Nothing
WScript.Quit
End Sub

'------------ end vbscript ------------------------------


|I saved a bunch of animated Gifs from a website. About 400 of them.
| Rather than save them one by one, I just saved the entire webpage which
| had about 10 to 15 per page. Then I just went to the saved page,
| deleted the .htm file and the other junk, such as the scripts and
| headers. What remained were just the .GIF files.
|
| I thought this would save time, but I soon found out different. Instead
| of saving the file by it's name
|
| (EXample):
|
| ANIMATED GIFS DOG 01.GIF
|
| I got this:
|
| ANIMATED%20GIFS%20DOG%2001.GIF
|
| Why does it do this? It fills in all the blanks with %20, which seems
| really senseless and is annoying as hell.
| This is not the first time I've had this happen....
|
| So, rather than save time, I now have 400 files to rename, one by
| one....
|
| Just for the heck of it, I googled for "Bulk file remaner". I did
| download one program called "Bulk Rename Utility". I wasted an hour
| trying to understand the program, and deleted it. It makes no sense at
| all. That seems to be all that is available for this sort of use.
| All the time I wasted trying to understand that program, I could have
| manually renamed half the files.
 
I saved a bunch of animated Gifs from a website. About 400 of them.
Rather than save them one by one, I just saved the entire webpage which
had about 10 to 15 per page. Then I just went to the saved page,
deleted the .htm file and the other junk, such as the scripts and
headers. What remained were just the .GIF files.

I thought this would save time, but I soon found out different. Instead
of saving the file by it's name

(EXample):

ANIMATED GIFS DOG 01.GIF

I got this:

ANIMATED%20GIFS%20DOG%2001.GIF

Why does it do this? It fills in all the blanks with %20, which seems
really senseless and is annoying as hell.
This is not the first time I've had this happen....

So, rather than save time, I now have 400 files to rename, one by
one....

Just for the heck of it, I googled for "Bulk file remaner". I did
download one program called "Bulk Rename Utility". I wasted an hour
trying to understand the program, and deleted it. It makes no sense at
all. That seems to be all that is available for this sort of use.
All the time I wasted trying to understand that program, I could have
manually renamed half the files.

http://en.wikipedia.org/wiki/File_URI_scheme

"Characters such as the hash (#) or question mark (?) which are
part of the filename should be "percent-encoded".
"

http://en.wikipedia.org/wiki/Percent-encoding

If you were a programmer, there is a great site for
comparing techniques. In this example, they practice
removing %20. They're not doing file renaming
though, which would mean adding a few more
lines of code.

http://rosettacode.org/wiki/URL_decoding

Here, some people propose DOS-like scripts
for the job. I suspect this code is removing
one %20 at a time.

http://www.computing.net/answers/programming/batch-remove-20-from-filenames/13957.html

I would do it in some other language. And the
job would likely take me all day to get right :-)
Maybe I'd crack my PERL book and do it there.
I think I have ActiveState PERL on the box here
somewhere... It's a freebie. It would probably
take around ten lines, tops... if I could
figure it out :-)

Paul
 
The %20 is the hexadecimal representation of a space. For a web
address, you cannot have spaces in a file name you want to link to so it
either displays or automatically starts the download process.

"One of the most common special characters is the space. You can't type
a space in a URL directly. A space position in the character set is 20
hexadecimal. So you can use %20 in place a space when passing your
request to the server.

"http://www.example.com/new pricing.html

"This URL actually retrieves a document named new pricing.html from the
www.example.com"


http://www.tutorialspoint.com/html/html_url_encoding.htm

That's the best I can offer without knowing the URL you started from.

<snip>

Ok, that makes sense. If I had clicked "SAVE AS" for each file, it
would have saved them with the actual spaces. So instead of doing all
of that, now I have to rename them all. Either way, it's a pain, but I
just rename a few at a time. I could just leave them too, but I hate
names like that.
 
http://en.wikipedia.org/wiki/File_URI_scheme

"Characters such as the hash (#) or question mark (?) which are
part of the filename should be "percent-encoded".
"

http://en.wikipedia.org/wiki/Percent-encoding

If you were a programmer, there is a great site for
comparing techniques. In this example, they practice
removing %20. They're not doing file renaming
though, which would mean adding a few more
lines of code.

http://rosettacode.org/wiki/URL_decoding

Here, some people propose DOS-like scripts
for the job. I suspect this code is removing
one %20 at a time.

http://www.computing.net/answers/programming/batch-remove-20-from-filenames/13957.html

I would do it in some other language. And the
job would likely take me all day to get right :-)
Maybe I'd crack my PERL book and do it there.
I think I have ActiveState PERL on the box here
somewhere... It's a freebie. It would probably
take around ten lines, tops... if I could
figure it out :-)

Paul

If it takes all day, I can manually rename them much faster. This is a
one shot deal, so no sense getting all involved. But I will try that
script from mayayana and see if I can do it.
I have had to rename multiple files in the past, but never this many.
But even if I did them all at once (manually) I could do it in 2 hours
tops. I already did about 100 of them. But that script looks like a
challenge. I'll already made a copy in case I screw up. I just
winzipped the whole folder.
 
There are decent file renamers out there. It is a real problem with
MP3 files in the binary groups. I have not used the one I had for a
while but I will look for it.

It would handy to have a utility like this, but that one I tried seemed
worthless. It might work, but I'd probably have to spend a week trying
to figure it out. Just seeing the screen shot of it looked like extreme
bloat, but it was a small download so I thought I'd try. Yeah, I recall
when I had access to binary newsgroups, the file names were real bizarre
at times for MP3s.
 
Ok, that makes sense. If I had clicked "SAVE AS" for each file, it
would have saved them with the actual spaces. So instead of doing all
of that, now I have to rename them all. Either way, it's a pain, but I
just rename a few at a time. I could just leave them too, but I hate
names like that.

Would it be quicker to delete all of them and then download again using
Save As?


--
Ken
Mac OS X 10.8.5
Firefox 25.0
Thunderbird 24.3.0
"My brain is like lightning, a quick flash
and it's gone!"
 
Would it be quicker to delete all of them and then download again using
Save As?

Hmmmmm, I wonder if you could use the Rename command and wildcards in
the Command Prompt window and make it work?


--
Ken
Mac OS X 10.8.5
Firefox 25.0
Thunderbird 24.3.0
"My brain is like lightning, a quick flash
and it's gone!"
 
I saved a bunch of animated Gifs from a website. About 400 of them.
Rather than save them one by one, I just saved the entire webpage which
had about 10 to 15 per page. Then I just went to the saved page,
deleted the .htm file and the other junk, such as the scripts and
headers. What remained were just the .GIF files.

I thought this would save time, but I soon found out different. Instead
of saving the file by it's name

(EXample):

ANIMATED GIFS DOG 01.GIF

I got this:

ANIMATED%20GIFS%20DOG%2001.GIF

Why does it do this? It fills in all the blanks with %20, which seems
really senseless and is annoying as hell.
This is not the first time I've had this happen....

So, rather than save time, I now have 400 files to rename, one by
one....

Just for the heck of it, I googled for "Bulk file remaner". I did
download one program called "Bulk Rename Utility". I wasted an hour
trying to understand the program, and deleted it. It makes no sense at
all. That seems to be all that is available for this sort of use.
All the time I wasted trying to understand that program, I could have
manually renamed half the files.
I've got a VERY simple bulk file renamer (freeware) that will do what
you want, I've been using it for years. Works ok on 98, XP and W7 (32
and 64), not tried on anything else.

You can just replace part or all of the filename with your own text,
including an incremental number, and preview the result before
applying the change.

Unfortunately it's obsolete and I cant find any download source to
refer you to. It's called "Rename-it" but the things that google find
are more recent, and much more complex.

I've got it in a 106Kb zip file, which I'd be happy to email to you,
or put in my OneDrive (SkyDrive) for you.

(remove the -notme to email me)
 
Just for the heck of it, I googled for "Bulk file remaner". I did
download one program called "Bulk Rename Utility". I wasted an
hour trying to understand the program, and deleted it. It makes
no sense at all.

Too bad for you. It's a very useful program that I use almost daily.
That seems to be all that is available for this
sort of use. All the time I wasted trying to understand that
program, I could have manually renamed half the files.

Any time you put into learning the program now will be more than repaid
to you in the future. Instant gratification doesn't get you very far in
the computer world. Or the real world, for that matter.
 
In message <[email protected]>, Ken Springer

possibly in a for ... in ... structure?

I'm not following, J. P. I was thinking creative use of wildcards.

--
Ken
Mac OS X 10.8.5
Firefox 25.0
Thunderbird 24.3.0
"My brain is like lightning, a quick flash
and it's gone!"
 
Believe or not, Irfanview has batch filename utilities. I had to
rename hundreds of filenames for a clients web page I did for him.
It would worth it to just check it out... it's a free program:
http://www.irfanview.com/

Yes, that's a very nice feature of Irfanview, and one that I use pretty
often. You can tell it construct file names out of the EXIF tags, which
I use to name them after the date and time.

Bulk Rename Utitlity can do that, too.
 
Believe or not, Irfanview has batch filename utilities. I had to
rename hundreds of filenames for a clients web page I did for him. It
would worth it to just check it out... it's a free program:
http://www.irfanview.com/



I don't see them on the irfanview web page. Can you point us to them
more specifically? Thanks.
 
Ok, that makes sense. If I had clicked "SAVE AS" for each file, it
would have saved them with the actual spaces. So instead of doing all
of that, now I have to rename them all. Either way, it's a pain, but I
just rename a few at a time. I could just leave them too, but I hate
names like that.

You might be able to do this with TCC LE, a DOS enhancement, using the
rename function. You can read about it in the online manual, I think,
without downloading the program. Free for personal use.
 
Hmmmmm, I wonder if you could use the Rename command and wildcards in
the Command Prompt window and make it work?

Maybe, but far more likely with the TCC LE Rename command. By JP
Software. Free for individual use. (Personal use sounded too pesonal.)



Purpose: Rename files or subdirectories.



Format: REN [/A:[[-][+]rhsadecijopt] /B /E /I"text" /N[enst]
/O:[-]adegnrstu /P /Q /S /T] [@file] old_name... new_name

or

RENAME [/A:[[-][+]rhsadecijopt] /E /I"text" /N[enst] /O:[-]adegnrstu /P
/Q /S /T] [@file] old_name... new_name



old_name Original name of the file(s) or subdirectory.

new_name New name to use, or new path on the same drive.

@file A text file containing the names of the source files to rename,
one per line (see @file lists for details).



/A: (Attribute select) /O:... (Order)

/B (Rename on reboot) /P(rompt)

/E (No error messages) /Q(uiet)

/I"text" (match description) /S(ubdirectory)

/MD (Create target directory) /T(otal)

/N (Disable)



See also: COPY and MOVE.



File Selection:



Supports attribute switches, extended wildcards, ranges, multiple file
names, delayed variable expansion, and include lists. Use wildcards with
caution on LFN volumes; see LFN File Searches for details.



Internet: Can be used with FTP/HTTP Servers and HTTP/HTTPS servers.



Usage:



REN and RENAME are synonyms. You may use either one.



REN lets you change the name of a file or a subdirectory, or move one or
more files to a new subdirectory on the same drive. (If you want to move
files to a different drive, use MOVE.)



In its simplest form, you give REN the old_name of an existing file or
subdirectory and then a new_name. The new_name must not already exist;
you can't give two files the same name (unless they are in different
directories). The first example renames the file MEMO.TXT to MEM.TXT.
The second example changes the name of the \WORD directory to \WP:



rename memo.txt mem.txt

rename /s \word \wp



When you rename files or directories on an LFN drive, you must quote any
names which contain white space or special characters.



You can also use REN to rename a group of files that you specify with
wildcards, as multiple files, or in an include list. When you do, the
new_name must use one or more wildcards to show what part of each
filename to change. Both of the next two examples change the extensions
of multiple files to .SAV:



ren config.nt autoexec.nt tcstart.btm *.sav

ren *.txt *.sav



REN can move files to a different subdirectory on the same drive. When
it is used for this purpose, REN requires one or more filenames for the
old_name and a directory name for the new_name:



ren memo.txt \wp\memos\

ren oct.dat nov.dat \data\save\



The final backslash in the last two examples is optional. If you use it,
you force REN to recognize the last parameter as the name of a
directory, not a file. The advantage of this approach is that if you
accidentally mistype the directory name, REN will report an error
instead of renaming your files in a way that you didn't intend.



REN can also move files to a new directory and change their name at the
same time if you specify both a path and file name for new_name. In this
example, the files are renamed with an extension of .SAV as they are
moved to a new directory:



ren *.dat \data\save\*.sav



If you use REN to rename a directory, the new_name must normally be
specified explicitly, and cannot contain wildcards. You can override
this restriction with /S. When you rename a directory the extended
directory search database will be automatically updated to reflect the
change.



You can also rename a subdirectory to a new location in the directory
tree on the same physical drive (sometimes called "prune and graft").
You must specify the new name explicitly, not just give the path. For
example, if the D:\TCMD directory contains a subdirectory TEST, you can
rename TEST to be a subdirectory of the root directory like this:



[d:\tcmd] ren TEST \TEST\



REN does not change a file's attributes, except to set attribute A. The
new_name file(s) will have the same attributes as old_name.



If you have appropriate permissions, you can rename files on FTP, HTTP,
and HTTPS servers. For example:



ren ftp://ftp.abc.com/file1.txt file2.txt



Wildcard characters like [*] and [?] will be treated as wildcards in FTP
URLs, but will be treated as normal characters in HTTP URLs.


You can also use the IFTP command to start an FTP session on a server,
and then use an abbreviated syntax to specify the files and directories
you want. For more information, see Using FTP/HTTP Servers and IFTP.



Note: The wildcard expansion process will attempt to allow both
CMD.EXE-style "extension" matching (assumes only one extension, at the
end of the word) and the advanced TCC string matching (allowing things
like *.*.abc) when an asterisk is encountered in the destination of a
REN command.



Options:



/A: Rename only those files that have the specified attribute(s) set.
See Attribute Switches for information on the attributes which can
follow /A:. Do not use /A: with @file lists. See @file lists for
details.



/B If REN can't rename the file (i.e., access denied), it will schedule
it to be renamed at the next reboot.



/E Suppress all non-fatal error messages, such as "File Not Found."
Fatal error messages, such as "Drive not ready," will still be
displayed. This option is most useful in batch files.



/I"text" Select files by matching text in their descriptions. The text
can include wildcards and extended wildcards. The search text must be
enclosed in double quotes, and must follow the /I immediately, with no
intervening spaces. You can select all filenames that have a description
with /I"[?]*", or all filenames that do not have a description with
/I"[]". Do not use /I with @file lists. See @file lists for details.



/MD Create the target directory if it doesn't exist. Note that you
*must* either terminate the target directory name with a trailing \ or
specify a filename component; otherwise REN cannot tell what you want
for the directory and what you want for the filename.



/N Do everything except actually rename the file(s). /N displays how
many files would be renamed. This option is useful for testing what a
REN command will actually do.



A /N with one or more of the following arguments has an alternate
meaning:



e Don't display errors.

n Don't update the file descriptions

s Don't display the summary

t Don't update the CD / CDD extended directory search database
(JPSTREE.IDX).



/O:... Sort the files before processing. (Not available in TCC/LE.)



You may use any combination of the sorting options below. If multiple
options are used, the listing will be sorted with the first sort option
as the primary key, the next as the secondary key, and so on:



n Sort by filename and extension, unless e is explicitly included. This
is the default.

- Reverse the sort order for the next sort key

a Sort names and extensions in standard ASCII order, instead of
numerically when numeric substrings are included in the name or
extension.

d Sort by date and time (oldest first); also see /T:acw

e Sort by extension

g Group subdirectories first, then files

r Reverse the sort order for all options

s Sort by size

t Same as d

u Unsorted



The /O:... option saves all of the matching filenames and then performs
the rename. This avoids the potential problem of renaming files more
than once.



/P Prompt the user to confirm each rename operation. Your options at the
prompt are explained in detail under Page and File Prompts.



/Q Don't display filenames or the number of files renamed. When used in
combination with the /P option above, it will prompt for filenames but
will not display the totals. This option is most often used in batch
files. See also /T.



/S Normally, you can rename a subdirectory only if you do not use any
wildcards in the new_name. This prevents subdirectories from being
renamed inadvertently when a group of files is being renamed with
wildcards. /S will let you rename a subdirectory even when you use
wildcards. /S does not cause REN to process files in the current
directory and all subdirectories as it does in some other file
processing commands. To rename files throughout a directory tree, use
GLOBAL REN.



/T Don't display filenames as they are renamed, but report the number of
files renamed. See also /Q.
 
I don't see them on the irfanview web page. Can you point us to
them more specifically? Thanks.

File | Batch Conversion/Rename

or, from the Thumbnails view,

File | Start batch dialog with selected files
 
Back
Top