Rename directory name using batch file - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
Thread Tools Display Modes
Old 02-28-2007, 12:40 AM   #1 (permalink)
Newb Techie
Join Date: Feb 2007
Posts: 1
Default Rename directory name using batch file

Hi there,

I need help to rename all directories in a folder with the name structure as "" to "BS2315_20070212_2039" (ie i need to remove the ".zip" extension from all the directory names). These directories are created dynamically everyday from zip files which i unzip using the following batch file, hence the names of the directories is not known. I need a batch file which automatically changes the names of all the directories by removing ".zip" extension after unzipping the files using the batch file code shown below:

@echo off
xcopy c:\data_load c:\data_load_backup
cd c:\data_load_backup
for %%f in (*.zip) do unzip %%f -d c:\unzipped_data\%%f

Also, Is there any way by which we can parse directory names like a string and edit it. Hence use it later to rename the file name?

Something like..
for %%f in (*.zip) do (
unzip %%f -d c:\unzipped_data\%%f

--- set dirname as %%f
--- Edit dirname here..
--- rename %%f to dirname


Any help will be deeply appreciated..
tomato is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 03:03 PM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.