Solved

how to batch rename files without extension to .wpd files

Posted on 2007-12-05
9
1,096 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

17 Experts available now in Live!

Get 1:1 Help Now