Solved

how to batch rename files without extension to .wpd files

Posted on 2007-12-05
9
1,127 Views
Last Modified: 2010-05-18
i have thousands of files that dont have extensions on them to rename then to *.wpd files.  how do i go about doing this since they dont have extensions in the first place?  i am familiar with the rename dos command if they hae extensions but since they dont im stuck..can anyone help?
0
Comment
Question by:Matt Pessolano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 5

Accepted Solution

by:
Dr-4N earned 500 total points
ID: 20411452
even if they do not have extensions still you can use this command.
Place all files in a single folder better in the root of a partition better in c: and better to name the folder an easy name like a for example.  So for example you placed the folder named a in the c: root and you placed all your files in folder a
Open a dos command window and write the following in succession and press enter after every command
cd\
cd a
ren *.* *.wpd

and you are done
Please take care while writing dos commands because the spaces are important so in the second line there is a space between cd and a
in the third line there is a space between ren and *.* and another space between *.* and *.wpd
If you placed your folder in another partition then replace the first command by the partition letter followed by : so for example if it is d then the commands will be like this
d:
cd a
ren *.* *.wpd
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20411592
Using ren *.* *.wpd will rename files with extensions as well.
Save this as RenameWPD.cmd, adjust the source folder in which the files are that you wan to rename (currently C:\Temp), and run the script.
The script will process files in subdirectories as well.
The current version will only display the rename commands it would otherwise run, so that you can test it; remove the capitalized ECHO to run it for real.

@echo off
set SourceFolder=C:\Temp
for /f "delims=" %%a in ('dir /a:-d /b /s "%SourceFolder%\*."') do ECHO ren "%%a" "%%~na.wpd"

Open in new window

0
 
LVL 22

Expert Comment

by:Adam Leinss
ID: 20411850
What about "ren *.???  *.wpd"
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 85

Expert Comment

by:oBdA
ID: 20411958
This would obviously rename files with extensions as well.
And the more or less obvious solution
ren *. *.wpd
exits with a syntax error (and wouldn't rename files in subfolders).
0
 
LVL 22

Expert Comment

by:Adam Leinss
ID: 20412457
Ah yes, more than one way to skin a cat I guess.  The first posting of "ren *.* *.wpd" is definitely correct: I just tried it here, however, it will not work with subdirectories (if any).

"ren *.wpd *." does work...the reverse does not.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20412559
As I mentioned before: "ren *.* *.wpd" will rename files with extensions like test.txt to test.wpd as well, and dfschneider6673 asked specifically how to rename files without extensions.
0
 
LVL 22

Expert Comment

by:Adam Leinss
ID: 20412685
"ren *.* *.wpd" works for files without extensions, I just tried it.

Do this....

"ren *.wpd *." to strip the extensions off

then do a "ren *.* *.wpd" to slap them back on. Seems to work for me anyhow. (Vista, x86-32)
0
 
LVL 5

Expert Comment

by:Dr-4N
ID: 20415107
to oBdA

I told him to gather all those files in a separate folder so in that folder only those files which has got no extension. I wonder why we make things more complicated sometimes. To my opinion my suggestion was the shortest and easiest way
0
 
LVL 85

Expert Comment

by:oBdA
ID: 20415198
Running what effectively amounts to a one-liner is a lot easier than to first collect all files in the same folder, only to have to sort them out after the rename again; not to mention potential problems if different files in different folders have the same name.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question