Solved

how to batch rename files without extension to .wpd files

Posted on 2007-12-05
9
1,124 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 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Batch file output 20 95
how to run a batch process 16 55
How Do I Set Up XP Mode in Windows 7? 8 95
Looking for a program that deletes all files of same size 18 103
Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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