Solved

how to batch rename files without extension to .wpd files

Posted on 2007-12-05
9
1,089 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
  • 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 83

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
 
LVL 83

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 83

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 83

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
Are you unable to synchronize your OST (Offline Storage Table) file with Microsoft Exchange Server? Is your OST file exceeding 2 GB size limit? In Microsoft Outlook 2002 and earlier versions, there is a 2 GB size limit for the OST file. If the file …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now