Solved

how to batch rename files without extension to .wpd files

Posted on 2007-12-05
9
1,113 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 84

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 84

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 84

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 84

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Batch file output 20 91
WMIC Command LIne 5 44
Windows updates batch files 7 69
Windows XP under Hyper-V Server 2016 15 38
Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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